git問題--Push rejected: Push to origin/master was rejected


解決git問題

Push rejected: Push to origin/master was rejected

意思是git拒絕合並兩個不相干的東西 
此時你需要在打開Git Bash,然后進入相應的目錄,然后敲git命令

$ git pull origin master --allow-unrelated-histories

出現類似於這種信息就說明pull成功了:

$ git pull origin master --allow-unrelated-histories
From https://github.com/yanghaopeng/python_utils
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 utils/hello.py | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 323 insertions(+), 31 deletions(-)

將本地倉庫中的推送到github中,使用如下的git命令:

$ git push -u origin master

完了,去刷新github,就可以看到東西已經推送成功 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM