繁体   English   中英

git-未缓存服务器主机密钥-WindowsTwist

[英]git - Server host key not cached - Windows twist

我遇到了与git中的问题类似的问题-服务器主机密钥未缓存 ,但是有一种扭曲使最佳解决方案无法正常工作。

所不同的是,我试图从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.

由于我没有使用腻子来尝试连接,所以我尝试了使用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.

我选择不继续连接,因为如果我连接了,它只会在git_hosts文件中放一个无助git进行工作的条目。

有人知道如何解决这个问题吗?

我有一位同事给我一个提示,最终使我摆脱了问题。 我上面发布的直接问题的答案是,我没有以期望的格式给ssh端口号。 您无需像这样指定端口号...

ssh stash.mycompany.com:7999

...但是像这样:

ssh -p 7999 stash.mycompany.com

这种语法使ssh询问我是否要将主机存储在已知主机列表中,并且给了我Stash告诉我应该使用的指纹。 (在我说是之后,ssh挂断了我的Git Bash提示符,我不得不终止整个Git Bash会话并开始一个新的会话。但是至少主机已经存储在known_hosts文件中。:))

一旦解决了这个问题,我唯一要做的另一件事就是在该线程github中应用一个解决方案:没有可用的支持的身份验证方法 ,该方法是在我的.bash_profile中为Git Bash设置GI​​T_SSH变量。

export GIT_SSH=/bin/ssh.exe

完成上述操作并重新启动Git Bash之后,git开始使用我的ssh密钥进行工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM