想在git上push代碼 於是在git上建立了一個私有的長褲, 連接後push代碼時提示如下錯誤:
error: failed to push some refs to '[email protected]:....." Updates were rejected because the remote contains work that you do not have locally.
This is usually caused by another repository pushing to
大概原因就是 意思是本地和遠程的文件應該合併後才能上傳本地的新文件
使用菜單上的 同步 推 拉 都無法解決,
出現錯誤如下:
F:\game_project\node_project>git push -u origin master
To https://gitee.com/cn_xxxxx/node.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/cn_xxxxx/node.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、先拉下來,會自動合併的(不用操心)
git pull origin master
2、再上傳
git push -u origin master
成功解決問題,
可能還有一個小問題,前提是遠程倉庫創建的項目,不要創建任何文件,爲空最好