如何使用GitLab克隆git存储库

时间:2016-10-22 08:04:47

标签: git bash ssh gitlab

我们的团队在gitlab上有一个git存储库。我在那里有一个帐户。我在一台计算机上创建了ssh密钥。现在我想将该repo克隆到另一台机器上。在我的帐户中,我可以在" SSH密钥"上看到我的公钥。部分,我也可以在"帐户"中找到我的私人令牌。部分。起初我想使用smartgit的现有密钥,它确实工作然后我创建了新密钥,将新的公钥添加到我的帐户并尝试从git bash克隆如下:

git clone  git@gitl.website.com: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 git@gitl.website.com

的最后一行
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).

1 个答案:

答案 0 :(得分:3)

去清洁板岩。创建一个新密钥并对其进行操作。

  1. 通过跑步, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { if (mMyView == null) { mMyView = new MyView(getActivity()); } else { ((ViewGroup) mMyView.getParent()).removeView(mMyView); } return mPuzzleView; } 并为其提供密钥名称。

  2. 复制ssh-keygen并在gitlab帐户中粘贴您的密钥。

  3. 清除系统中已存在的所有剩余密钥,keyname.pub

  4. 添加您刚创建的密钥ssh-add -D

  5. 现在,再试一次git命令。