2016-10-22 253 views
0

我們的團隊在gitlab上有一個git倉庫。我在那裏有一個帳戶。我在一臺電腦上創建了ssh密鑰。現在我想將該repo克隆到另一臺機器。在我的帳戶中,我可以在「SSH密鑰」部分看到我的公鑰,也可以在「帳戶」部分看到我的私人令牌。起初我想用現有的鍵與smartgit,它did`t工作,然後我創建了新的密鑰,即新的公共密鑰添加到我的帳戶,並試圖從混帳慶典克隆這樣的:如何用GitLab克隆git倉庫

git clone [email protected]:bla/bla.git 

但它給我

Cloning into 'bla'... 
Permission denied (publickey). 
fatal: Could not read from remote repository. 

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

我甚至試圖從我的賬戶GitLab直接複製公鑰到 id_rsa.pub文件。

那麼我怎樣才能得到克隆的存儲庫?

編輯

末線從ssh -vvv [email protected]

debug3: send packet: type 5 
debug3: receive packet: type 6 
debug2: service_accept: ssh-userauth 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug3: send packet: type 50 
debug3: receive packet: type 51 
debug1: Authentications that can continue: publickey 
debug3: start over, passed a different list publickey 
debug3: preferred publickey,keyboard-interactive,password 
debug3: authmethod_lookup publickey 
debug3: remaining preferred: keyboard-interactive,password 
debug3: authmethod_is_enabled publickey 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /c/Users/Arthur/.ssh/id_rsa 
debug3: send_pubkey_test 
debug3: send packet: type 50 
debug2: we sent a publickey packet, wait for reply 
debug3: receive packet: type 51 
debug1: Authentications that can continue: publickey 
debug1: Trying private key: /c/Users/Arthur/.ssh/id_dsa 
debug3: no such identity: /c/Users/Arthur/.ssh/id_dsa: No such file or directory 
debug1: Trying private key: /c/Users/Arthur/.ssh/id_ecdsa 
debug3: no such identity: /c/Users/Arthur/.ssh/id_ecdsa: No such file or directo      ry 
debug1: Trying private key: /c/Users/Arthur/.ssh/id_ed25519 
debug3: no such identity: /c/Users/Arthur/.ssh/id_ed25519: No such file or direc      tory 
debug2: we did not send a packet, disable method 
debug1: No more authentication methods to try. 
Permission denied (publickey). 
+0

*「我甚至試圖從我的賬戶GitLab直接複製公鑰到id_rsa.pub文件。」 *。這是非常糟糕的主意。反過來這樣做。在你的電腦上,你需要私鑰。從發佈的ssh'混帳-vvv @日誌gitl.website.com' – Jakuje

+0

的Git的bash可能不會增加私鑰編輯與日誌訊息的SSH代理 – Luke

+0

。那麼我怎麼手動添加它? –

回答

3

轉到清白。創建一個新的密鑰並處理它。

  1. 通過運行, ssh-keygen,併爲其提供一個鍵名。

  2. 複製keyname.pub並粘貼到您的密鑰在gitlab帳戶。

  3. 清除殘留的鑰匙已經在你的系統中存在,ssh-add -D

  4. 通過ssh-add <path_to_key>/keyname

添加剛剛創建的關鍵,重試Git命令。