Avoiding GitHub’s SSH Permissions Prompt

ssh-github

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:

  1. The clone links on the side of GitHub pages are HTTPS-based

  2. So if you use that default clone you’ll have an HTTPS endpoint

  3. 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.

From:

[remote "origin"]
url = https://github.com/danielmiessler/yourepo.git

To:

[remote "origin"]
url = [email protected]:/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 ./git/config. ]

Making this simple change will make it so that you can work from within SSH without getting prompted.

Notes

  1. Not getting prompted assumes you’re using an SSH key, of course.

Related posts: