Reputation: 5458
I am using GitHub Desktop on Windows 10. I initially cloned a repo using its HTTPS URL, but now our organisation have advised that we must use the SSH URL instead. So I have changed this over.
I have also copied the contents of my public SSH key (id_rsa.pub
) in to my GitHub account. My SSH key is protected by a passphrase.
Now when I try to do to a sync in GitHub Desktop I get the following error:
In Git Bash it works fine (it asks me for my passphrase before each pull/push though). Any idea what I need to do to make this work?
Upvotes: 36
Views: 65791
Reputation: 1
For vs 2019 edit:
Upvotes: 0
Reputation: 1528
I had this issue but was related to my Docker container ssh keys weren't in my windows .ssh/ folder.
%userprofile%.ssh/
Upvotes: 0
Reputation: 1330102
As more recently seen in "Permission failure cloning in Git in Windows", try and launch GitHub Desktop after:
(warning: read comments first)
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
That will ensure GitHub Desktop to use the right OpenSSH ssh.exe
, instead of an internal one, as seen in desktop/desktop
issue 5641.
If Git bash does not work properly after that, you can either:
revert the configuration:
git config --global --unset core.sshCommand
or use the Git for Windows SSH
git config --global core.sshCommand "'C:\Program Files\Git\usr\bin\ssh.exe'"
If C:\Program Files\Git\usr\bin\
is already in your %PATH%
, you don't even need that configuration: the ssh.exe
from Git For Windows would be the one selected by default.
Upvotes: 14
Reputation: 7632
I had this issue now as well. SSH was working fine in git-bash with ssh-agent and so forth.
But if you use TortoiseGit, for me the easiest was to use TortoiseGitPlink.exe globally as ssh-client, from TortoiseGit, git-bash and github desktop:
git config --global core.sshCommand "'C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe'"
This will by default use Pageant to cache your passphrase for current session. After setting this, GitHub Desktop immediately started working again with ssh repos.
Upvotes: 0
Reputation: 21
After searching and trying to use ssh-agent unsuccessfully, I found if you start github desktop using a git bash shell, it will prompt you for a passphrase. I added an alias to my .bash_profile to make starting github desktop easy.
eval C:/Users/labrat/AppData/Local/GitHubDesktop/GitHubDesktop.exe
I also have my git core.sshCommand set to this, which works for both git bash and github desktop:
git config core.sshCommand "'C:\\Program Files\\Git\\usr\\bin\\ssh.exe' -i C:/Home/.ssh/id_rsa_name"
Upvotes: 2
Reputation: 33
I was able to get it working by creating an ssh config file with the content similar to what is provided in this gist:
https://gist.github.com/JoaquimLey/e6049a12c8fd2923611802384cd2fb4a
The minimal content I needed to get it working was
Host github.com
IdentityFile /c/Users/username/.ssh/id_github
When cloning the repository I had to use the URL option because the Github.com tab will use the HTTPS url.
Upvotes: 2