! [rejected] master -> master (fetch first) error: failed to push some refs to 'git@github.com:abc70/new.git'

+2 votes

Hi,

I am getting the below error when trying to push data from local to GitHub.

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:abc70/new.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Thank You

Feb 14 in Git & GitHub by akhtar
• 33,720 points
10,711 views

3 answers to this question.

+3 votes
Best answer
git push origin master --force
I met the same issue and this works for me
answered Apr 29 by anonymous

selected Nov 12 by MD
Thank you it really worked :-)

I was facing the issue mentioned above, but this command worked well in my case.

Thanks worked.
It worked, thankyou
thank you it worked
0 votes

Hi@akhtar,

 Here you tried to push your repo to GitHub. But before that fetch the metadata from GitHub.

$ git fetch

Thank You

answered Feb 14 by MD
• 79,930 points
0 votes
You get this error when your Github repository has a file which is not in your local computer.

(when you create a file in the repository after doing a push).

Solution1 : Cut that file you have in the Github and paste in the local machine. Now do git push -u origin master.

Solution2 :  git push origin master --force . This will override the content in the github repository with that in your local machine.
answered Aug 14 by anonymous

Related Questions In Git & GitHub

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,560 points
545 views
0 votes
1 answer

Error: git pull fails “unable to resolve reference” “unable to update local ref”

This happens when there are unnecessary files ...READ MORE

answered Jul 26, 2018 in Git & GitHub by Sophie may
• 10,100 points
7,849 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
815 views
+2 votes
1 answer