无法从 Sourcetree 拉出 Git 远程存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32437659/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:34:44  来源:igfitidea点击:

cannot pull Git remote repository from Sourcetree

gitgithubsshatlassian-sourcetree

提问by functional_overflow

I Generated ssh keys and configured my git and SourceTree. I could git pull and do other operations from Git-bash. Note: I have added the following in .bashrc to make it work.

我生成了 ssh 密钥并配置了我的 git 和 SourceTree。我可以 git pull 并从 Git-bash 执行其他操作。注意:我在 .bashrc 中添加了以下内容以使其工作。

eval `ssh-agent`
ssh-add

However, when I try to git pull in SourceTree, I get this.

但是,当我尝试在 SourceTree 中 git pull 时,我得到了这个。

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin Permission denied (publickey,password). fatal: Could not read from remote repository.

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

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin 权限被拒绝(公钥,密码)。致命:无法从远程存储库读取。

请确保您拥有正确的访问权限并且存储库存在。

When I tried to create ssh-key from Putty(windows), it goes further, but waits with this following message!

当我尝试从 Putty(windows) 创建 ssh-key 时,它更进一步,但等待以下消息!

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin 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 0f:ee:bb:1c:6c:b4:50:0e:54:d6:e9:55:9b:38:45:df If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection.

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin 服务器的主机键没有缓存在注册表中。您无法保证服务器就是您认为的计算机。服务器的 rsa2 密钥指纹为:

ssh-rsa 2048 0f:ee:bb:1c:6c:b4:50:0e:54:d6:e9:55:9b:38:45:df 如果您信任此主机,请输入“y”将密钥添加到PuTTY的缓存并进行连接。如果您只想继续连接一次,而不将密钥添加到缓存中,请输入“n”。如果您不信任此主机,请按 Return 放弃连接。

if I open the terminal in SourceTree(which is git-bash), it asks me for passphrase. So, i suspect my .bashrc is not sourced by SourceTree. Or am I missing something else?

如果我在 SourceTree(这是 git-bash)中打开终端,它会要求我输入密码。所以,我怀疑我的 .bashrc 不是来自 SourceTree。还是我错过了其他东西?

回答by JPelletier

I had the same problem and the solution for me was to call plink.exe manually with my server (GitLab):

我遇到了同样的问题,我的解决方案是使用我的服务器(GitLab)手动调用 plink.exe:

"C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe" gitlab.com

Press ywhen asked and you should be fine now!

y当被问到时按,你现在应该没事了!

回答by AlikElzin-kilaka

I changed the client configuration from putty to openssh. Did the job. Screencap:

我将客户端配置从 putty 更改为openssh。做了工作。屏幕截图:

enter image description here

在此处输入图片说明

回答by luchopintado

I was able to fix the problem by changing from "Putty/Plink" SSH to "OpenSSH" for the SSH provider.

我能够通过将 SSH 提供商的“Putty/Plink”SSH 更改为“OpenSSH”来解决该问题。

Menu Tools > Options then SSHClient, select OpenSSH

回答by Kabkee

The best solution is to get a connection using Putty.

最好的解决方案是使用 Putty 建立连接。

On the Host Name, put your gitlab project ssh address. then, click 'Open' to connect.

在主机名上,输入您的 gitlab 项目 ssh 地址。然后,单击“打开”进行连接。

That's it. SourceTree trust gitlab.com after all. you may check the solution from the below link. https://answers.atlassian.com/questions/31659457/windows-7-64bits-sourcetree-openssh-putty-git-pull-not-working

就是这样。毕竟,SourceTree 信任 gitlab.com。您可以从以下链接查看解决方案。 https://answers.atlassian.com/questions/31659457/windows-7-64bits-sourcetree-openssh-putty-git-pull-not-working