mojtaba1
mojtaba1

Reputation: 73

how to solve error with pushing in github

I wanted to push my project in github as usual. but I got this error. what it means, and what I should do?

! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/mojt/profile4.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 very much in advance.

Upvotes: 0

Views: 1809

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522762

The critical portion of the error message is this:

hint: Updates were rejected because the remote contains work that you do hint: not have locally.

The remedy for this problem is probably just doing a pull:

git pull origin master

The problem is that you are asking GitHub to play one or more commits onto a base which has diverged from the base on which you actually made those commits. By pulling first, you are updating your base such that it becomes possible for GitHub to accept your commits.

Upvotes: 1

Related Questions