錯誤信息:
error: failed to push some refs to 'git@github.com:....." Updates were rejected because the remote contains work that you do not have locally.
This is usually caused by another repository pushing to
原因分析:
1、在使用git 對源代碼進行push到gitHub時可能會出現的此錯誤
2、出現錯誤的主要原因是github中的README.md文件不在本地代碼目錄中
解決辦法:
辦法1:先拉下來,會自動合并的(不用操心)
命令:git pull origin master
辦法2:可以通過如下命令進行代碼合并
命令:git pull --rebase origin master (我的成功解決是方法2)
最后:再執行語句 git push 即可完成代碼上傳到github
命令:git push -u origin master