日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

如何解決git上傳文件出錯 [rejected] cjp -> cjp (fetch first)error: failed to push some refs to

作者:小陳同學,, 更新時間: 2022-04-12 編程語言

很久沒提交代碼了,使用Git上傳本地文件到github時,出現報錯

git add .
git commit -m"拖拽"
git push origin cjp

當執行到push時,就會報錯,報錯代碼如下:

$ git push origin cjp
To http://xxx.git
 ! [rejected]        cjp -> cjp (fetch first)
error: failed to push some refs to 'http://xxx.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.

出現這個問題是因為github中的README.md文件不在本地代碼目錄中,可以通過如下命令進行代碼合并

git pull --rebase origin cjp

?然后

git push origin cjp

便可上傳成功!

原文鏈接:https://blog.csdn.net/ping_lvy/article/details/121033644

欄目分類
最近更新