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, 2020 in Git & GitHub by akhtar
• 38,260 points
64,528 views
git push origin master --force

3 answers to this question.

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

selected Nov 13, 2020 by MD
worked well thankyou
thanks worked really good
Great ! it's work ....Thanks
git push origin main --force
This work well for me.
thank you........ It worked for me
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, 2020 by MD
• 95,460 points
Thanks it worked
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 15, 2020 by anonymous
Thank you :)
0 votes
Hello, you could try.

1) git pull

2) git push
answered May 19, 2022 by anonymous

edited 6 days ago
0 votes
git push origin main --force

I face the same problem , you must try this also
answered Jul 6, 2022 by Brijraj Rathore

edited 6 days ago

Related Questions In Git & GitHub

+1 vote
1 answer

master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:abc70/new.git'

git pull < branch> <branch name > ctrl+x git ...READ MORE

answered Mar 21, 2023 in Git & GitHub by anonymous

edited 6 days ago 20,355 views
+1 vote
1 answer
0 votes
1 answer

git error: failed to push some refs to remote

I would advise using: git pull --rebase git push The ...READ MORE

answered May 2, 2022 in Git & GitHub by narikkadan
• 63,600 points
8,635 views
0 votes
1 answer
+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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,244 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP