Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT Push Errors - Duplicate Request

Tags:

git

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 >

like image 709
Sudhi Avatar asked Dec 07 '15 17:12

Sudhi


People also ask

Why is git push failing?

failed to push some refs to errors are often caused when changes are not committed before pushing, issues with Git pre-push hook, incorrect branch name, or the local repository not being in sync with the Git repository.

How do I fix git error failed to push some refs to?

How to Fix error: failed to push some refs to Error in Git Using git pull. To send a pull request means to "fetch" new changes made to the remote repo and merge them with the local repo. Once the merging is done, you can then push your own code changes to GitHub.


2 Answers

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'

like image 100
Sats Avatar answered Oct 20 '22 22:10

Sats


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.

like image 2
mkrufky Avatar answered Oct 20 '22 23:10

mkrufky