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 >
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 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.
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'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With