2016-03-22 18 views
5

Lệnh git của tôi không hoạt động từ tuần trước, tất cả những gì tôi nhớ là tôi khởi động một thư mục cục bộ vào phiên bản git được điều khiển và thêm một từ git ref vào nó. Sau đó, git của tôi không thể đẩy hoặc kéo. Nó cho thấy:Gitlab - Quá nhiều lỗi xác thực cho git

git clone [email protected]:xxx/myproj.git myproj 
Cloning into 'myproj'... 
Received disconnect from 192.168.xxx.xxx: 2: Too many authentication failures for git 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

Có gì lạ là kiểm soát phiên bản của tôi trong JetBrain Idea hoạt động tốt, nó vẫn có thể kéo hoặc đẩy rằng dự án mà không thể được kéo vào dòng lệnh.

Tôi đã thêm id_rsa.pub vào gitlab trước đây và tôi thêm lại nó ngay bây giờ, nhưng nó không hoạt động.

My info ssh debug

ssh -v [email protected]

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 
debug1: Reading configuration data /etc/ssh_config 
debug1: /etc/ssh_config line 20: Applying options for * 
debug1: Connecting to gitlab.xxx.com [192.168.xxx.xxx] port 22. 
debug1: Connection established. 
debug1: identity file /Users/abc/.ssh/id_rsa type -1 
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1 
debug1: identity file /Users/abc/.ssh/id_dsa type -1 
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 
debug1: match: OpenSSH_5.3 pat OpenSSH_5* 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60 
debug1: Host 'gitlab.corp.com' is known and matches the RSA host key. 
debug1: Found key in /Users/abc/.ssh/known_hosts:127 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8 
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git 
[email protected]:~/.ssh$ 
[email protected]:~/.ssh$ ls 
authorized_keys id_rsa   known_hosts  tmp/ 
[email protected]:~/.ssh$ rm known_hosts 
[email protected]:~/.ssh$ ssh -v [email protected] 
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 
debug1: Reading configuration data /etc/ssh_config 
debug1: /etc/ssh_config line 20: Applying options for * 
debug1: Connecting to gitlab.corp.com [192.168.100.218] port 22. 
debug1: Connection established. 
debug1: identity file /Users/abc/.ssh/id_rsa type -1 
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1 
debug1: identity file /Users/abc/.ssh/id_dsa type -1 
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 
debug1: match: OpenSSH_5.3 pat OpenSSH_5* 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60 
The authenticity of host 'gitlab.corp.com (192.168.100.218)' can't be established. 
RSA key fingerprint is d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'gitlab.corp.com,192.168.100.218' (RSA) to the list of known hosts. 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5 
debug1: Authentications that can continue: publickey,password,hostbased 
debug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8 
Received disconnect from 192.168.100.218: 2: Too many authentication failures for git 
+0

Có thể intellij không sử dụng cùng một khóa với% HOME% \. Ssh? Hãy thử http://stackoverflow.com/a/26427400/6309 – VonC

+0

@VonC cảm ơn, tôi chỉ không muốn tạo lại chứng chỉ rsa của mình, bởi vì tôi đã sử dụng nó ở mọi nơi, chẳng hạn như xác minh đăng nhập ssh của máy chủ sản xuất của tôi – Alexis

+0

Bạn có thể tạo bao nhiêu phím tùy thích, với một tên khác. – VonC

Trả lời

5

Bạn có thể sử dụng url ssh khác để tham chiếu khóa công khai/riêng tư bạn muốn.
Thêm vào HOME của bạn/.ssh một file có tên cấu hình:

Host   mygitlab 
Hostname  gitlab.xxx.com 
User   git 
IdentityFile ~/.ssh/id_rsa.gitlab 
IdentitiesOnly yes 

Và thay đổi url của bạn:

git clone mygitlab:xxx/myproj.git myproj 

Bằng cách đó, bạn tránh được những hành vi ssh mặc định trong đó trình bày tất cả các phím cho ssh thử .

3

Trước hết thiết lập phím ssh của bạn.

Nếu phím của chúng tôi được thiết lập một cách chính xác - cố gắng khởi động lại ssh-agent

eval $(ssh-agent) 

Bạn sẽ thấy PID của tiến trình và bạn r phím sẽ được tải.

Để thêm khóa của bạn theo cách thủ công, hãy sử dụng: ssh-add. Thao tác này sẽ tải các khóa từ bạn theo mặc định .ssh thư mục

+0

ssh-add là một bước quan trọng tôi bỏ qua. Cảm ơn bạn –

0

cuối cùng - khởi động lại nguyên thủy của máy chủ hoạt động, nhưng muốn biết những gì thực sự xảy ra ...

3

enter image description here

Trong SourceTree, hãy thử thay đổi SSH ClientPuTTY/Plink-Open SSH.

Các vấn đề liên quan