我遇到了一个与git - Server host key not cached中类似的问题,但有一个问题使最好的解决方案不起作用。
转折是,我正试图从Stash克隆一个存储库,这是一个来自Atlassian的类似git-hub的应用程序,我们公司使用它来存储它的git存储库。在Stash中输入我的公钥之后,我使用Git Bash尝试使用系统提供的ssh地址从那里克隆一个存储库。这就是结果:
$ git clone ssh://git@stash.mycompany.com:7999/teamproject/gitrepo.git
Cloning into 'gitrepo'...
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 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:12
Connection abandoned.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.因为我没有使用putty来尝试连接,所以我尝试了使用ssh连接到服务器的解决方案:
$ ssh ssh://git@stash.mycompany.com:7999/teamproject/gitrepo.git
ssh: stash.mycompany.com:7999/teamproject/gitrepo.git: no address associated with name如果我尝试缩短ssh可以识别的地址,我得到的指纹与git拒绝的指纹不同:
$ ssh ssh://git@stash.mycompany.com
The authenticity of host 'stash.mycompany.com (10.XX.XXX.XX)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:34.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.我选择不继续连接,因为如果我连接了,它只会在我的known_hosts文件中放置一个无助于git完成其工作的条目。
有人知道如何解决这个问题吗?
发布于 2014-10-31 22:16:26
我有一个同事给了我一个提示,最终让我忘记了我的问题。我在上面发布的直接问题的答案是,我没有按照ssh预期的格式给它提供端口号。您不能像这样指定端口号...
ssh stash.mycompany.com:7999...but应该是这样的:
ssh -p 7999 stash.mycompany.com这种语法导致ssh询问我是否要将主机存储在已知主机列表中,它给出了Stash告诉我应该使用的指纹。(在我同意之后,ssh挂起了我的Git Bash提示符,我不得不终止整个Git Bash会话并开始一个新的会话。但至少主机已经存储在known_hosts文件中。:)
一旦我解决了这个问题,我唯一需要做的就是在这个线程github: No supported authentication methods available中应用一个解决方案,即在我的.bash_profile中为Git Bash设置GIT_SSH变量
export GIT_SSH=/bin/ssh.exe在我完成这项工作并重新启动Git Bash之后,git开始使用我的ssh密钥工作。
https://stackoverflow.com/questions/26661921
复制相似问题