Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Git error set

Shulou Source: shulou.com Published: 2022-06-01 08:51:15 10月17日 Update

Git push failed failed to push some refs to git

Https://www.zybuluo.com/hwk603/note/172823

Several solutions to errors in native code push to git:

Https://www.douban.com/note/332510501/

The github version library you just created has an error in push code:

$git push-u origin master

To git@github.com:*/Demo.git

! [rejected] master-> master (non-fast-forward)

Error: failed to push some refs to 'git@github.com:*/Demo.git'

Hint: Updates were rejected because the tip of your current branch is behind

Hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')

Hint: before pushing again.

Hint: See the 'Note about fast-forwards' in' git push-- help' for details.

I searched the Internet because of the conflict between the remote repository and my local repository, and after I created the version library, I clicked the button to create the README.md file on the github version library page to create the documentation, but there was no pull to the local. This gives rise to the problem of version conflicts.

There are several solutions:

1. Use the method of forcing push:

$git push-u origin master-f

This will result in the loss of remote modifications, which is generally undesirable, especially when multi-person collaborative development.

Modify the remote repository to pull before 2.push

$git pull origin master

$git push-u origin master

3. If you don't want to merge remote and local modifications, you can create a new branch first:

$git branch [name]

And then push

$git push-u origin [name]

Tags: Version method code conflict branch multiperson button file document time problem page e.g. first collaboration development compulsion search error Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology OPPO Reno Shulou Tech Info Huawei Xiaomi