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...
$ 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_rsaI then re-tried the push command, and it worked. Cool.
UPDATE: Can just do ssh-add without being in the .ssh directory


