davehansen’s posterous

« Back to blog

Git troubleshooting

When Git tells you it failed to push some refs (link)

I received an unhelpful error while trying to push to a repository on Github today:

 git push
To git@github.com:user/repo.git
! [rejected] branchname -> branchname (non-fast forward)
error: failed to push some refs to 'git@github.com:user/repo.git'

In case you ever have the same problem, all you have to do is a quick git pull first, then you can carry on as normal. Easy when you know how...

github and public key (link)

 $ git push origin master Permission denied (publickey). fatal: The remote end hung up unexpectedly error: failed to push to 'git@github.com:stonean/stage.git' 

I knew it was a configuration issue, just wasn’t sure if it was a git thing or not. After a minute or two of thinking it through, all I needed to do was:

 $ cd ~/.ssh $ ssh-add id_rsa

I then re-tried the push command, and it worked. Cool.

UPDATE: Can just do ssh-add without being in the .ssh directory

Loading mentions Retweet

Comments (0)

Leave a comment...

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     Connect     twitter