简体   繁体   English

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

[英]cannot pull Git remote repository from Sourcetree

I Generated ssh keys and configured my git and SourceTree.我生成了 ssh 密钥并配置了我的 git 和 SourceTree。 I could git pull and do other operations from Git-bash.我可以 git pull 并从 Git-bash 执行其他操作。 Note: I have added the following in .bashrc to make it work.注意:我在 .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). git -c diff.mnemonicprefix=false -c core.quotepath=false 获取源权限被拒绝(公钥,密码)。 fatal: Could not read from remote repository.致命:无法从远程存储库中读取。

Please make sure you have the correct access rights and the repository exists.请确保您具有正确的访问权限并且存储库存在。

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. git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin 服务器的主机密钥没有缓存在注册表中。 You have no guarantee that the server is the computer you think it is.您无法保证服务器就是您认为的计算机。 The server's rsa2 key fingerprint is:服务器的 rsa2 密钥指纹为:

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. ssh-rsa 2048 0f:ee:bb:1c:6c:b4:50:0e:54:d6:e9:55:9b:38:45:df 如果您信任此主机,请输入“y”将密钥添加到PuTTY的缓存并进行连接。 If you want to carry on connecting just once, without adding the key to the cache, enter "n".如果您只想进行一次连接,而不将密钥添加到缓存中,请输入“n”。 If you do not trust this host, press Return to abandon the connection.如果您不信任此主机,请按 Return 放弃连接。

if I open the terminal in SourceTree(which is git-bash), it asks me for passphrase.如果我在 SourceTree(即 git-bash)中打开终端,它会要求我输入密码。 So, i suspect my .bashrc is not sourced by SourceTree.所以,我怀疑我的 .bashrc 不是由 SourceTree 提供的。 Or am I missing something else?还是我错过了其他东西?

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 y when asked and you should be fine now!当被问到时按y ,你现在应该没事了!

I changed the client configuration from putty to openssh .我将客户端配置从 putty 更改为openssh

Go to: Menu Tools > Options > SSH Client转到: Menu Tools > Options > SSH Client

在此处输入图像描述

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

Menu Tools > Options then SSHClient, select OpenSSH

The best solution is to get a connection using Putty.最好的解决方案是使用 Putty 建立连接。

On the Host Name, put your gitlab project ssh address.在主机名上,输入您的 gitlab 项目 ssh 地址。 then, click 'Open' to connect.然后,单击“打开”进行连接。

That's it.而已。 SourceTree trust gitlab.com after all. SourceTree 毕竟信任 gitlab.com。 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 https://answers.atlassian.com/questions/31659457/windows-7-64bits-sourcetree-openssh-putty-git-pull-not-working

gitlab.com currently (as of 06-28-2022) has a bug where it will fail using plink / ssh. gitlab.com 目前(截至 2022 年 6 月 28 日)有一个错误,使用 plink / ssh 会失败。

The fix is to set the "winadj" bug fix setting in your putty configuration for gitlab.com修复是在 gitlab.com 的腻子配置中设置“winadj”错误修复设置

Image below is of the screen "Chokes on winadj" is set to "On" instead of "Auto".下图是屏幕“Winadj 上的扼流圈”设置为“开”而不是“自动”。 This fixes the problem.这解决了问题。

在此处输入图像描述

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

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