当前位置:   article > 正文

git push -u origin master 本地代码上传gitlab远程仓库出错_$ git push -u origin "master" enumerating objects:

$ git push -u origin "master" enumerating objects: 3, done. counting objects

 

问题信息:

当我们将本地代码上传至服务器时,git push -u origin master

报如下错误信息

问题原因:在新建的仓库的时候,勾选了README.md, 远程仓库的README.md不在本地仓库中.(同理,如果远程仓库中具有的文件,本地仓库没有,就会有冲突,此时就需要去合并)

  1. $ git push -u origin master
  2. To http://xxxxxxxxx/xxxxx/xxxx.git
  3. ! [rejected] master -> master (fetch first)
  4. error: failed to push some refs to 'xxxxxxxxx/xxxxx/xxxx.git'
  5. hint: Updates were rejected because the remote contains work that you do
  6. hint: not have locally. This is usually caused by another repository pushing
  7. hint: to the same ref. You may want to first integrate the remote changes
  8. hint: (e.g., 'git pull ...') before pushing again.
  9. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决方案:

git pull --rebase origin master

  1. $ git pull --rebase origin master
  2. warning: no common commits
  3. remote: Enumerating objects: 3, done.
  4. remote: Counting objects: 100% (3/3), done.
  5. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
  6. Unpacking objects: 100% (3/3), done.
  7. From http://xxxxxxxx/xxxxxxx/xxxx.git
  8. * branch master -> FETCH_HEAD
  9. * [new branch] master -> origin/master
  10. First, rewinding head to replay your work on top of it...
  11. Applying: first commit

然后再重新git push -u origin master

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

闽ICP备14008679号