当前位置:   article > 正文

git push -u orrgin master错误解决_uorr

uorr

错误提示为:

To github.com:PorterLi/myDataStructCode.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:PorterLi/myDataStructCode.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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

原因:
远程仓库有本地没有的文件。即,两个仓库不同步,这种情况下需要利用git pull 命令合并两个仓库。

解决方法:
1.先利用git add 和git commit 将本地暂存区的内容添加到仓库
2.git status 查看本地仓库内容,如下则可进行第三步

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
  • 1
  • 2
  • 3
  • 4

3.命令如下,合并两个仓库。

git pull --rebase origin master
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/387988
推荐阅读
相关标签
  

闽ICP备14008679号