简体   繁体   中英

cannot pull Git remote repository from Sourcetree

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.

eval `ssh-agent`
ssh-add

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

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.

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

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.

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?

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

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

Press y when asked and you should be fine now!

I changed the client configuration from putty to openssh .

Go to: 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.

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

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

gitlab.com currently (as of 06-28-2022) has a bug where it will fail using plink / ssh.

The fix is to set the "winadj" bug fix setting in your putty configuration for gitlab.com

Image below is of the screen "Chokes on winadj" is set to "On" instead of "Auto". This fixes the problem.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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