Reputation: 1047
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?
Upvotes: 84
Views: 71317
Reputation: 11
I had same issue on my machine with newest Source Tree Version. Only thing that helped to me is to open command prompt (not Power Shell) and execute following line of the code.
My Source Tree was installed under AppData not ProgramFiles - check path of your SourceTree app installation.
"C:\Users{username}\AppData\Local\SourceTree\app-3.4.15\tools\putty\plink.exe" bitbucket.org
You will be prompted with following message
Store key in cache? (y/n, Return cancels connection, i for more info) y
enter y
Afterwards you will be prompted to enter (bitbucket or gitlab) credentials - you can ingore that.
Upvotes: 1
Reputation: 1
it's pretty complicated, but you can go to registry
\HKEY_USERS\S-1-5-21-1530211238-4060388584-3209713061-1001\SOFTWARE\SimonTatham\PuTTY\SshHostKeys and add something like rsa2@2222:127.0.0.1 as REG_SZ and server fingerprint from error, like 0x10001,0xc10790789c2f8aa97d79cbaebd1445863f6db3bb4e04236de1c3ab60e271a20da10ebc87f931a71e090a3b847cde28d0a751222f91a5c7a7f13f7d3bfa42d40b2c58a85c0667eb879b092d04706ccc6d2ec51c2ae77c08e51b2bbad425fefaf27a4e9253240809babc02e5ee93c167825311f38b15947034211db2bc50a76bd87a5f2542d30c0a09e35750ba36008aee3031efbec188fdfc8b39be3db0e01ee2ab95909e423e00c89e3da6a2bec9eed6f21dfffee9deceb5b560a5a6fa720059229e6c37a1952a4981d62fc62af2b6318057d758124c34644b6f771ab02b398043e1b5727ed22b199e943e467d0bb4b96c4689ca749cc9edb8bee028dcb9b6ef
Upvotes: 0
Reputation: 198
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
Upvotes: 5
Reputation: 12877
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.
Upvotes: 1
Reputation: 35991
I changed the client configuration from putty to openssh.
Go to: Menu Tools
> Options
> SSH Client
Upvotes: 190
Reputation: 939
I was able to fix the problem by changing from "Putty/Plink" SSH to "OpenSSH" for the SSH provider.
Menu Tools > Options then SSHClient, select OpenSSH
Upvotes: 17
Reputation: 2109
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!
Upvotes: 104