Authentication Failure on Github even after adding SSH key
github, ssh
Solution
That depends on the remote url you have used.
If `git remote -v` returns:
https://github.com/username/reponame
Then your ssh setup won't matter. But this would work:
ssh://git@github.com:username/reponame
Another cause is linked to your private key: if it is pass-phrase protected, with a special character in it, that usually don't work well. See here for other ssh causes of failure.
To replace your remote named `origin`, use `git remote` commands:
git remote set-url origin ssh://git@github.com:username/reponame
(as explained in the GitHub help page about changing the rmeote url)
If you see::
ssh: Could not resolve hostname github.com:amangupta052:
Name or service not known
fatal: The remote end hung up unexpectedly
Try the non-scp ssh syntax:
git remote set-url origin ssh://git@github.com/username/reponame
(note the '`/`' instead of the '`:`' after `github.com`)
Maybe this would have worked, as commented in this blog post:
git remote set-url origin git@github.com:username/reponame
(scp-like syntax, but without the `ssh://` prefix)
As I mention here, an scp syntax usually means an `~/.ssh/config` file to work properly.
Problem
I get fatal:Authenication Failure when I try to push code to my repo. I've added the public key on my github account as well. When I do : `ssh -i git@github.com` I get `Hi amangupta052! You've successfully authenticated, but GitHub does not provide shell access.` Can anyone help? Thanks