Search code examples
gitemacsgithubmagit

failed to push some refs to 'https://github.com/myname/myrepo'


question on magit / push

I'm starting using magit, with very little experience in git.

I've gone trough the magit manual with success for :

adding
ignoring
staging
commiting locally

Then, I try to push on github.com/myname. For that, I use 'P P', entering then my username and password.

If fails with

To https://github.com/myname/myrepo ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/myname/myrepo'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push –help' for details.

git exited abnormally with code 1.

I thought I would solve it as mentionned here with git config --global push.default current But it doesn't help.

I've had a lok at Geting an error pushing to github - Updates were rejected because a pushed branch tip is behind its remote but did'nt got it to work

Any idea ?


Solution

  • You have to either pull changes first or push -f the changes.