! [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