Reputation: 229
New to GIT and facing the below issue when pushing local branch changes to master. Any help appreciated
! [remote rejected] HEAD -> refs/for/master (duplicate request) error: failed to push some refs to < some SSH site >
Upvotes: 11
Views: 20743
Reputation: 1121
The issue is evident from the error message itself.
execute git log
and you should notice two different commits for the same changes. i.e. Change Id will be same for different commit ids.
You should revert latest duplicate commit and merge the same with existing one.
Use the following commands for solution.
git reset --soft HEAD^
git status
git commit --amend
Now try to push the changes 'git push origin HEAD:refs/for/master'
Upvotes: 36
Reputation: 3398
Chances are, there may be new changes on the remote that you do not yet have in your local repository. You may want to either git pull --rebase
or git pull
followed by a merge before attempting to git push
again.
Upvotes: 2