无法与gitlab建立ssh连接

时间:2017-06-22 08:30:37

标签: git ssh

我在gitlab上有一个项目,我试图将提交推送到。我首先使用https url克隆了项目,但后来将其更改为ssh,然后运行了ssh -Tv git@myEmail,它给了我ssh密钥:我已经将密钥粘贴到我的gitlab配置文件中的ssh密钥,但是在尝试推送提交我收到了一条消息:

  

主持人的真实性' gitlab'无法建立。 RSA密钥   指纹是SHA256:cZiqgz2tMzLXftNIIXmQ9v + 6M38xM1LzxROnDM1OJ0Q。   您确定要继续连接(是/否)吗?是   警告:永久添加' 07.no,' myIpAddress' (RSA)到已知主机列表。   权限被拒绝(公钥)。

正在运行OpenSSH_7.4p1, LibreSSL 2.5.0 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to myEmail [myIpAddress] port 22. debug1: Connection established. debug1: identity file /Users/myUser/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/myUser/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-9etch3 debug1: match: OpenSSH_4.3p2 Debian-9etch3 pat OpenSSH_4* compat 0x00000000 debug1: Authenticating to myEmail:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: diffie-hellman-group-exchange-sha1 debug1: kex: host key algorithm: ssh-rsa debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<7680<8192) sent debug1: got SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: got SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: ssh-rsa SHA256:Wcsi4VBAIf2M+M62Gx16W2yCR8rbtm9yh/WiQRe707o debug1: Host 'myEmail' is known and matches the RSA host key. debug1: Found key in /Users/myUser/.ssh/known_hosts:2 debug1: rekey after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey after 4294967296 blocks debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/myUser/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/myUser/.ssh/id_dsa debug1: Trying private key: /Users/myUser/.ssh/id_ecdsa debug1: Trying private key: /Users/myUser/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).

var app=angular.module('ContactsApp', ['ngRoute', 'ui.bootstrap', 'ngDialog']);

// register the interceptor as a service
app.factory('HttpInterceptor', ['$q', '$rootScope', function($q, $rootScope) {
       return {
            // On request success
            request : function(config) {
                // Return the config or wrap it in a promise if blank.
                return config || $q.when(config);
            },

            // On request failure
            requestError : function(rejection) {
                //console.log(rejection); // Contains the data about the error on the request.  
                // Return the promise rejection.
                return $q.reject(rejection);
            },

            // On response success
            response : function(response) {
                //console.log(response); // Contains the data from the response.
                // Return the response or promise.
                return response || $q.when(response);
            },

            // On response failure
            responseError : function(rejection) {
                //console.log(rejection); // Contains the data about the error.
                //Check whether the intercept param is set in the config array. 
                //If the intercept param is missing or set to true, we display a modal containing the error
                if (typeof rejection.config.intercept === 'undefined' || rejection.config.intercept)
                {
                    //emitting an event to draw a modal using angular bootstrap
                    $rootScope.$emit('errorModal', rejection.data);
                }

                // Return the promise rejection.
                return $q.reject(rejection);
            }
        };
 }]);


// MY DIRECTIVE FOR CHECKING IF THE USERNAME IS ALREADY USED
app.directive('usernameAvailable', function($timeout, $q, $http, ContactService) {
  return {
    restrict: 'AE',
    require: 'ngModel',
    link: function(scope, elm, attr, ngModel) { 
      ngModel.$asyncValidators.usernameExists = function() {   

        return ContactService.searchContactByName('ADAM').success(function(contact){
          $timeout(function(){

            ngModel.$setValidity('usernameExists', contact); 
            ngModel.$setValidity('unique', false);
            scope.contacts = contact;     
alert(contact.length);          
          }, 1000);
        }); 


      };
    }
  } 
});

app.controller('ctrlAddContacts', function ($scope, ContactService){

    $scope.title="Add a contact";   

    ContactService.getCountry().success(function(countries){
        $scope.countries = countries;       
    }); 

    ContactService.loadCategory('undefined',0).success(function(categories){
        $scope.categories = categories;
    }); 

    $scope.Category = function (contactType) {
        if (contactType){
            ContactService.loadCategory(contactType,0).success(function(categories){
            $scope.categories = categories;         
            }); 
        }
    }       

    $scope.submitForm = function(contact){
        if($scope.ContactForm.$valid){      
            ContactService.addNewPerson(contact).success(function(Person){
                $scope.ContactForm.$setPristine();
                $scope.contact= Person;
                var personID = Person[0]["ID"];
                window.location="#/view-contacts/" + personID;

            });
        }
    }
});

我该如何解决?

1 个答案:

答案 0 :(得分:-1)

它告诉你以前从未连接过这台服务器。如果你期待的话,这是完全正常的。如果您是偏执狂,请使用备用频道验证密钥的校验和/指纹。 (但请注意,可以重定向ssh连接的人也可以重定向Web浏览器会话。)

如果您在安装此ssh之前已连接到此服务器,则服务器已使用新密钥重新配置,或者有人欺骗服务器的标识。由于中间人攻击的严重性,它会警告你这种可能性。

无论哪种方式,您都有一个安全的加密通道给某人。没有与指纹对应的私钥的任何人都无法解码您发送的内容。

您用来对自己进行身份验证的密钥是无关的...您不希望将身份验证信息发送给可能会窃取它的欺诈性服务器,因此您不应期望任何更改,具体取决于您是否要使用用于登录的密码或私钥。你还没有完成这个过程。