GitHub

GitHub not accepting public SSH key: fix it by switching from HTTP(S) to SSH in the Git repository config

Submitted by Peter Majmesku on Mon, 08/29/2016 - 19:57

If you clone a Git repository from GitHub via the HTTPS URL, which is placed in the section as shown below, than your public SSH key will not be recognized by GitHub.

You can test your public SSH key for GitHub usage by the following command:

ssh -T git@github.com
GitHub

If you have chosen the wrong HTTPS option before (it must be SSH), you can fix that by the following steps.

  1. Open the file at .git/config
  2. Look for 
    url = http://github.com/path/to/repository or url = https://github.com/path/to/repository
  3. Replace it by
    url = ssh://git@github.com/path/to/repository
  4. Save the file and GitHub will accept the public SSH key on the next push. No username and password typing anymore.
Tags
Subscribe to GitHub