Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git-服务器主机密钥未缓存-Windows twist_Git_Ssh_Git Bash_Bitbucket Server - Fatal编程技术网

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

git-服务器主机密钥未缓存-Windows twist,git,ssh,git-bash,bitbucket-server,Git,Ssh,Git Bash,Bitbucket Server,我遇到了一个类似于中的问题,但有一个转折点,那就是最好的解决方案不起作用 问题在于,我正试图从Stash克隆一个存储库,这是一个类似Atlassian git hub的应用程序,我们公司使用它来存储git存储库。在将公钥输入到Stash之后,我使用gitbash尝试从那里克隆一个存储库,并使用系统提供的ssh地址。这就是结果: $ git clone ssh://git@stash.mycompany.com:7999/teamproject/gitrepo.git Cloning into '

我遇到了一个类似于中的问题,但有一个转折点,那就是最好的解决方案不起作用

问题在于,我正试图从Stash克隆一个存储库,这是一个类似Atlassian git hub的应用程序,我们公司使用它来存储git存储库。在将公钥输入到Stash之后,我使用gitbash尝试从那里克隆一个存储库,并使用系统提供的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.
我选择不继续连接,因为如果我连接了,它只会将一个不帮助git完成其工作的条目放入我的已知_hosts文件中


有人知道如何避开这个问题吗?

我让一位同事给了我一个提示,最终让我克服了这个问题。我在上面发布的直接问题的答案是,我没有按照ssh所期望的格式提供端口号。您没有像这样指定端口号

ssh stash.mycompany.com:7999
…但更像这样:

ssh -p 7999 stash.mycompany.com
这种语法导致ssh询问我是否想将主机存储在已知主机列表中,它给了我一个指纹,这个指纹是Stash告诉我它应该使用的。(在我说是之后,ssh挂断了我的Git Bash提示符,我不得不终止整个Git Bash会话并启动一个新的会话。但至少主机已经存储在已知的_hosts文件中。:)

一旦我解决了这个问题,我唯一要做的另一件事就是在这个线程中应用一个解决方案,那就是在我的.bash\u概要文件中为GIT bash设置GIT_SSH变量

export GIT_SSH=/bin/ssh.exe

在我完成这项工作并重新启动Git Bash之后,Git开始使用我的ssh密钥工作。

我让一位同事给了我一个提示,最终解决了我的问题。我在上面发布的直接问题的答案是,我没有按照ssh所期望的格式提供端口号。您没有像这样指定端口号

ssh stash.mycompany.com:7999
…但更像这样:

ssh -p 7999 stash.mycompany.com
这种语法导致ssh询问我是否想将主机存储在已知主机列表中,它给了我一个指纹,这个指纹是Stash告诉我它应该使用的。(在我说是之后,ssh挂断了我的Git Bash提示符,我不得不终止整个Git Bash会话并启动一个新的会话。但至少主机已经存储在已知的_hosts文件中。:)

一旦我解决了这个问题,我唯一要做的另一件事就是在这个线程中应用一个解决方案,那就是在我的.bash\u概要文件中为GIT bash设置GIT_SSH变量

export GIT_SSH=/bin/ssh.exe

在我这样做并重新启动Git Bash之后,Git开始使用我的ssh密钥工作。

请务必接受答案,即使它是您自己的!这非常有用-谢谢!一定要接受答案——即使是你自己的答案!这非常有用-谢谢!因此,从长远来看,没有“使最好的解决方案不起作用的扭曲”,它只是起了作用。因此,从长远来看,没有“使最好的解决方案不起作用的扭曲”,它只是起了作用。