格里特无法克隆

时间:2013-05-17 10:12:05

标签: git gerrit

我正在尝试创建一个gerrit审查系统,并且能够成功地使gerrit在端口8084上运行并且审查正在29429端口上成功完成。

当我尝试运行git clone ssh://user@ip:29429/myrepo.git时,我收到以下错误:

Cloning into 'myrepo'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 a1:bc:b8:fe:e7:79:c9:34:96:28:7d:6f:d3:3d:af:9b
Connection abandoned.
fatal: Could not read from remote repository.

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

当我运行ssh -p 29429 user@ip gerrit ls-project时 它要求我输入我的密码。当我输入密码时 我能够看到myrepo

以下情况也很好(确保用户可以使用gerrit)

$ ssh -p 29429 user@ip
Enter passphrase:

输入密码后,我得到以下

  

****欢迎使用Gerrit Code Review ****

     

嗨,用户,您已通过SSH成功​​连接。

     

不幸的是,禁用了交互式shell。    要克隆托管的Git存储库,请使用:

     

git clone ssh://user@ipaddress:29429/REPOSITORY_NAME.git

     

连接到ip关闭。

请帮助哪里出错。我做错了什么或遗失了什么?

1 个答案:

答案 0 :(得分:5)

问题在于Putty和连接端口(29429)。事情是两点。

第1点:如果您将私钥和公钥保留在Windows的.ssh文件夹中,那么当您执行ssh -p 29429 user @ ip时,它会要求输入密码并欢迎您使用gerrit代码审核消息。

第2点。克隆时如果得到这个'服务器的主机密钥没有缓存在注册表中等 - 连接被放弃了。致命:无法从远程存储库中读取。“这是由于该端口上的putty没有连接造成的。

要解决此问题,请登录该特定端口上的putty(29429),然后接受主机密钥(基本上在弹出窗口中单击“是”)。你需要在这里理解,它不会让你登录(这是完全正常的)。这只是缓存服务器密钥。

你可能想要删除〜/ .ssh / known_hosts,然后尝试使用ssh user @ ip和login在客户端(windows机器)的.ssh文件夹中创建known_hosts文件。但这不是它的目标。 Putty正在缓存其他地方(我不知道在哪里,但它不在这里)

然后保持你的腻子运行 - 加载你的私钥。然后尝试在git bash中克隆。这应该没问题。还要确保Putty Key gen生成的公钥放在Gerrit中 - 设置 - ssh键

如果你得到Permission denied(公钥)的例外,那么检查你的gerrit用户名,它可能是空的或无效的(与你的git配置设置不同)。

请确保在运行git config时--global --edit(名称和电子邮件ID应与您的gerrit设置相匹配)。