git Updates were rejected because the remote contains work that you do 解决办法

Username for 'https://github.com': dummymare
Password for 'https://[email protected]': 
To https://github.com/dummymare/Hello-World.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/dummymare/Hello-World.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.

进入项目目录后,执行 git pull 命令,没有将项目更新,并提示下图:

git Updates were rejected because the remote contains work that you do 解决办法_第1张图片

2、If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

使用上面的命令就可以将本地的分支和远程分支进行关联了。

如下:

<a href="http://www.tbdazhe.com/wp-content/uploads/2013/12/QQ_20131210110802.jpg" class="cboxElement" rel="example4" 238"="" style="text-decoration: none; color: rgb(1, 150, 227);">

 

如图:再执行git pull 就显示已经ok了。


你可能感兴趣的:(git Updates were rejected because the remote contains work that you do 解决办法)