01_ first time how to upload GitHub (rpm) Updates were rejected because the tip of your current branch is behind

https://www.cnblogs.com/code-changeworld/p/4779145.html

 

刚创建的github版本库,在push代码时出错:

$ git push -u origin master
To [email protected]:******/Demo.git
 ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:******/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.

 


Online search the next, because I have a remote repository and local repository lead to conflict, and I after creating the repository on github repository page, click the button to create a file created README.md the documentation, but did not pull locally. This creates a problem in the versions conflict.


There are several solutions:

1. use of push force:

$ git push -u origin master -f 

It would be modified remotely loss is generally not advisable, especially when many people work together to develop.

 


2.push remote repository before the first modified pull down

$ git pull origin master
$ git push -u origin master

 

3. If you do not want to merge the remote and local changes, you can create a new branch:

$ git branch [name]
Then push
$ git push -u origin [name]

 

Guess you like

Origin www.cnblogs.com/venicid/p/12013914.html