Home > database >  failed to push some refs to 'https://github.com/<username>/my-history.git'
failed to push some refs to 'https://github.com/<username>/my-history.git'

Time:03-30

I can't update the source code in the repository on github.com using the following command.

$ git push -u origin master

The following error is displayed:

! \[rejected\]        master -\> master (fetch first)
error: failed to push some refs to 'https://github.com/\<username\>/my-history.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.

Is there any way to do this?

I want to push the source code in the my repository.

CodePudding user response:

I experienced something similar to this a few days ago.

You can do something like this:

$ git remote add origin https://github.com/Dream0804/my-history.git
$ git push -f origin master
  • Related