If you’ve been using GitHub for any amount of time you may have seen the error above when trying to interact with a repo using SSH.
Happily, both the explanation and the fix are simple:
- The clone links on the side of GitHub pages are HTTPS-based
- So if you use that default clone you’ll have an HTTPS endpoint
- If you want your stuff to work using SSH you have to change the path to SSH instead of HTTPS
Basically, when you’re interacting with a repo there is a configuration element in your
.git/config file that indicates the remote origin URL, and it’s what needs to be changed.
[remote "origin"] url = https://github.com/danielmiessler/yourepo.git
[remote "origin"] url = email@example.com:/danielmiessler/yourepo.git
[ NOTE: If you do your original
git clone using the SSH version of the repo then this will be set in the config automatically. If you downloaded it via HTTPS then you’ll need to change the remote origin URL in
Making this simple change will make it so that you can work from within SSH without getting prompted.
- Not getting prompted assumes you’re using an SSH key, of course.