Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push origin master gives error permission denied (github)

Tags:

git

github

ssh

key

ERROR: Permission to durrantm/linker.git denied to kevinzen. fatal: The remote end hung up unexpectedly

I've tried a lot of things to change/set my identity and get rid of that 'kevinzen'

Update - final resolution was that I had added my public key... but... I had missed a few characters so it was invalid. Pasting in the correct key on github fixed it

I have ~/.ssh/ with files

  • config
  • id_dsa
  • id_dsa.pub
  • id_kb_rsa
  • id_kb_rsa.pub
  • id_rsa
  • id_rsa.pub
  • known_hosts

I have done

git config --global user.name
git config --global user.email
git remote add origin [email protected]:durrantm/linker.git

I have added my local ssh key with my info (not kevinz) for this machine to github ssh keys.

I also tried: ssh [email protected]. The authenticity of host 'github.com. (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com.' (RSA) to the list of known hosts. PTY allocation request failed on channel 0

wasn't sure about the PTY error. Still stuck.

like image 407
Michael Durrant Avatar asked Sep 07 '11 12:09

Michael Durrant


People also ask

How do I fix git push origin master?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

Can I push permission to denied GitHub?

GitHub's Permission denied (publickey) error is usually caused by one of the following three issues: You have used an incorrect email address in the GitHub SSH URL. You have not configured your public SSH key in your GitHub account. You must create GitHub SSH keys to be used by the secure shell.


2 Answers

Did you install your key at GitHub? Have you read help section there?

  • https://help.github.com/articles/reviewing-your-ssh-keys/
  • https://github.com/settings/keys

You can list your own keys as saved at GitHub by:

curl https://github.com/<username>.keys

Have you checked that one of the keys is a match to one of your keys? Compare:

cat ~/.ssh/id_*.pub
like image 182
sanmai Avatar answered Oct 18 '22 05:10

sanmai


I had the same problem, my solution was simple. I already have my keys setup and everything and kept trying to run:

git config --global user.name IceMupppet

After looking through my ~/.ssh/ I noticed that running:

ssh-add -l

I saw that to simply use the right git account I just added the right file:

ssh-add ~/.ssh/id_IceMupppet_rsa

... then a git push origin master worked fine. I have an alias on my ssh config to use different keys for my work and personal, but still had to do this step for some reason.

like image 25
Adam Wilson Avatar answered Oct 18 '22 03:10

Adam Wilson