1. 程式人生 > >github 如何解決error: failed to push some refs

github 如何解決error: failed to push some refs

oca ... rate class origin h+ wan blank --help

錯誤

error: failed to push some refs to https://github.com/whitclass/scrapy-spider.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 對源代碼進行push到gitHub時可能會出錯

2、出現錯誤的主要原因是github中的README.md文件不在本地代碼目錄中

3、可以通過如下命令進行代碼合並【註:pull=fetch+merge] 

git pull --rebase origin master

4、執行上面代碼後可以看到本地代碼庫中多了README.md文件

5、此時再執行語句 git push

即可完成代碼上傳到github

參考https://blog.csdn.net/orchidofocean/article/details/76599656

github 如何解決error: failed to push some refs