Repository navigation
Description
There's a collection of issues spread across multiple issues which touch on situations involving SSH remotes:
- a user isn't clear on how to setup their machine to consume SSH repositories: I can't connect to my own repository; I have never changed the default security settings. #2453 GitHub Desktop 1.0.1 Logged in but get authentication failure on push or pull #2847
I looked around, and I cannot see anywhere, either in the desktop app settings, nor in the settings for any repository, nor in my GitHub profile settings, where I would go about doing SSH remote configuration.
-
cloning a repo via SSH (and not defaulting back to https) - Allow to clone via SSH #2085
-
setting up an SSH key and registering it on GitHub on behalf of a user - Shell Choice from the GUI! (Also, proper SSH handling?) #2577
-
a repository with SSH submodules cannot be cloned because of a vague authentication failure: Authentication failed cloning public repo containing submodules #2344 Authentication failed while clonning private repo #2338
-
an SSH private may be protected with a passphrase - this can be handled by
ssh-agentor PuTTY Support non-GitHub hosted git repositories connection with ppk #2859 -
No way to trust unknown host keys - Github Desktop does not provide a UI to accept the public key of a new remote host #3457
-
Using plink causes pushes to hang - Push hangs using plink #8765
-
No option for a default protocol (option for default protocol #11885)
-
No support for hardware keys (Github now supports hardware SSH keys like Yubikey. Github Desktop silently hangs on pull/push to SSH repos using these keys. #12216)
-
Desktop does not use OpenSSH on Windows if running, favours embedded SSH (Desktop does not use OpenSSH on Windows if running, favours embedded SSH #5641)
The classic apps addressed some of this (at least on the Windows side):
- creating a new SSH key if not found and adding it to GitHub
- ensuring
ssh-agentwas running when launching the app or Git Shell - setting the right environment variables when performing Git operations
Activity
joshaber commentedon Aug 31, 2017
The Classic Mac app did essentially the same as Windows, minus the
ssh-agentstuff since that was unnecessary.mcmonkey4eva commentedon Oct 11, 2017
Does current GitHub Desktop support SSH remotes at all?
I ran ssh-agent, did ssh-add on my keys (all on a random git bash instance) and it was all successful.
Github Desktop then failed to fetch or pull an SSH repo.
For reference, old Github-Windows client pulls the same fine.
Fair note that I've never use ssh-agent manually before, so I may have messed up somewhere.
So two things:
shiftkey commentedon Oct 12, 2017
@mcmonkey4eva I ran through this guide again using the latest version of Desktop, and I was able to push changes to an SSH remote using Desktop. Maybe ensure you do
eval $(ssh-agent -s)before launching Desktop as this will environment variables that are important to Git.mcmonkey4eva commentedon Oct 12, 2017
I'm fairly sure SSH Agent is running fine.
Evidence for this is that the command line will pull the repo happily.
Desktop was started in first testing before the SSH Agent config, and later started after, as well as restarted past that point a few times. At no point was it able to pull.
I'm using a standard Git Bash (right click desktop ->
Git Bash Here) to open the SSH Agent.I've carefully ensured as well that there's never been more than one SSH Agent running at the same time. (Just launching the SSH Agent a second time will duplicate it normally)
shiftkey commentedon Oct 17, 2017
@mcmonkey4eva a thought: is there something interesting with your SSH key - does it have a passphrase associated with it?
mcmonkey4eva commentedon Oct 17, 2017
Nope! Standard old-github-desktop autogenerated SSH key, whose pub file was uploaded to an unrelated git server.
shiftkey commentedon Oct 25, 2017
@mcmonkey4eva
Was it named
github_rsaby any chance? That might be the issue - I've got a similar report of this which was fixed by renaming it toid_rsa.mcmonkey4eva commentedon Oct 25, 2017
It was yes .-.
Thanks for the info!
thenetimp commentedon Nov 20, 2017
Better error messages would be nice. For example on MacOS High Sierra if you don't use ssh-add to add your key because you are using a passphrase on your ssh key then github desktop throws a generic message of
"Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open preferences and verify that you're signed in with an account that has permission to access this repository."
If this message had been more specific, it wouldn't have taken me 30 minutes to figure out what was going on....
niik commentedon Nov 30, 2017
Added link to #3457 in the body
nanomebia commentedon Dec 1, 2017
it's probably a good idea to add in functionality to specify which key the desktop client will use by default (and also per-repo if people don't want to configure it via an ~/.ssh/config file) as users may have different keys for different repos/work domains/other domains
cicorias commentedon Apr 15, 2018
Can an option be added when I click on the
use desktopfrom the GitHub repo "clone" action that says "Use ssh - ONLY IF YOU KNOW WHAT YOU"RE DOING"...Just a pain. I love the "just click clone" flow for checking things out. But to push I have to update the origin via
git remote set-url...command - or use the Desktop settings and just paste it in. Minor but I look a a lot of code..chrisrapson commentedon Jul 18, 2018
@thenetimp (or anyone else) I don't suppose you know the workaround for github desktop refusing to push using a password protected ssh key in windows do you? When I run
ssh-addin gitbash, I getCould not open a connection to your authentication agent.mcmonkey4eva commentedon Jul 18, 2018
@chrisrapson you have to do
eval $(ssh-agent -s)first to start up the ssh agent - GitHub Desktop currently will not make use of it, but you can start it up, then use thessh-add, then pull/push within the git bash terminal.19 remaining items
h8nor commentedon Jun 25, 2021
It's amazing in Github Desktop x32 of latest version
ssh-agenthas always been launched, which could be checked by the commandssh-add -l. Terminal and Github Desktop easily picked upssh-agent.After Github Desktop x64 necessary to install the git with terminal separately (it has a useless script
start-ssh-agent.cmdfor Windows) and indicate the path to it. Terminal works only, the app doesn't react at all. To work in terminal needs script~/.profilethatssh-agentcloses along with terminal.There are comments pass is stored in an open form, so no longer saved (including Windows).
If so OpenSSH_8.x is an isolated app, Githab Desktop will not be able to work with ssh.
EasyArray commentedon Jul 20, 2021
I'm trying to use GitHub Desktop with a repository on a server at my university. This server does not have an https url (so I need ssh) but it also does not allow key authentication. You have to enter a password every time you ssh there. Is there any way to set up GitHub Desktop to work with this repository? Thanks!
steveward commentedon Aug 17, 2021
Thanks to the work of @sergiou87 we'll be shipping improved SSH support in GitHub Desktop. We would love for anyone in this thread who was encountering SSH issues to test it out by installing the Windows beta version. Let us know if you run into problems!
hardysim commentedon Aug 18, 2021
I've tried the current windows beta (2.9.1-beta4 x64) and it ask for the ssh key password right when opening it (and I checked the "save password" checkbox). But when trying to fetch something, I get the usual "Authentication failed" error dialog. I've tried using "system OpenSSH" in the settings but neither with or without it I get the same error.
sergiou87 commentedon Aug 18, 2021
@hardysim thank you for your feedback! Could you share your logs with me after getting that error so I can see why exactly?
hardysim commentedon Aug 18, 2021
Sure:
I have a feeling that it does not use the ssh key at all. I've removed GitHub Desktop and reinstalled but it did not ask for the ssh key password again.
sergiou87 commentedon Aug 18, 2021
That's because the key password is stored in the credentials manager. I wonder… is it possible you entered the wrong password for the SSH key? I just realized we're not handling that scenario properly, and the wrong password might be kept 🤦♂️
I'll look into that, meanwhile you can open the Credential Manager on Windows, and on Windows Credentials, look for
GitHub - SSH key passphrasesand delete that entry. The app should prompt you the key password again.hardysim commentedon Aug 18, 2021
Ahh here we go. Yes, it was wrong. After removing it from windows GitHub Desktop asks for it again and using the correct password, it fetches just fine. So please add a better handling when saving a wrong password and we're good to go.
sergiou87 commentedon Aug 18, 2021
@hardysim we have improved that behavior in #12800 and now it should only store good passwords. Those improvements are available in the latest beta 2.9.1-beta6
However, beware, we found an edge case where a certain combination of “remember passphrase” and “don’t remember passphrase” + bad password and good password, could cause the bad password to be stored. I'll tackle that one tomorrow!
Thank you again for your feedback! ❤️ 🙇♂️
sergiou87 commentedon Aug 24, 2021
This should be much better now with the release of GitHub Desktop 2.9.1 today 😄
Therefore, we decided to close this issue and start again with new issues found in its current state.
Thanks everyone for your help and patience! ❤️
ajtruckle commentedon May 20, 2022
I am completely and utterly confused.
In each case the files are no own names and in my own directories and with passphrase.
I have to use the HTTPS route.
Why? Please help. Confused out my mind.
steveward commentedon May 24, 2022
@ajtruckle I would recommend using Git for Windows instead of PuTTY and following the specific steps in this help article to get SSH working:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Make sure
ssh-agentis running and your key has been added.ajtruckle commentedon May 24, 2022
Hi @steveward Eventually I was given some help on StackOverflow:
https://stackoverflow.com/q/72345710/2287576
As you say, it was easier to move over to using SSH in the settings.
I eventually found out how to add the
ssh-agentservice and configure.Add remote and tag managers and an SSH key helper