! [rejected] master -> master (fetch first)


在将本地的master分支首次部署到远程的gitlab上面时,我们用git push -u origin master 命令执行报错如下:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'ssh://git@g.hz.netease.com:22222/XXXXX/fastmonkey.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.

出错的原因:gitlab中READE.md文件不在本地代码目录中
解决方法: $ git pull
--rebase origin master $ git push origin master

 

此时就可以了:    

 

注意:

   push之前需要先pull代码合并一下,再去push

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM