最後更新於 2021 年 5 月 21 日
本篇文章用來紀錄本人使用Git遇到的錯誤以及最終解決辦法。
git—如何解决fatal: remote origin already exists報錯window下git報錯
remote origin already exists //遠程分支已經存在,故報錯!
解決辦法:删除远程分支
git remote rm origin
重新添加遠程分支:
git remote add origin git@github.com:[your git name]/[your git repertory] //如: //git remote add origin git@github.com:Wbiokr/chatApp.git
解決辦法來源:武东10号
Git錯誤提示之:fatal: Not a git repository (or any of the parent directories): .git
產生原因:一般是没有初始化git本地版本管理倉庫,所以無法執行git命令
解决方法:操作之前執行以下命令行:git init
然后執行一下git status
查看狀態信息,good,問題解決。
解決辦法來源:水月沐风
git 解决 fatal: ‘origin’ does not appear to be a git repository
剛上傳代碼到 github 的時候,當我輸入 git push -u origin master
時,提示:
fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository
解决辦法:
git remote add origin git@github.com:xxse/xx.git
再次輸入:
git push -u origin master
解決辦法來源:卩杉
解决Git中fatal: refusing to merge unrelated histories
一、fatal: refusing to merge unrelated histories
今天在使用Git創建項目的时候,在兩個分支合併的時候,出現了下方錯誤。
~/SpringSpace/newframe on master ⌚ 11:35:56 $ git merge origin/druid fatal: refusing to merge unrelated histories
這裡的問題關鍵在於:fatal: refusing to merge unrelated histories
你可能會在git pull或者git push中都有可能會遇到,這是因為兩個分支沒有取得關係。
二、解决方案
在你操作命令后面加--allow-unrelated-histories
例如:
git merge master --allow-unrelated-histories
~/SpringSpace/newframe on druid ⌚ 11:36:49 $ git merge master --allow-unrelated-histories Auto-merging .gitignore CONFLICT (add/add): Merge conflict in .gitignore Automatic merge failed; fix conflicts and then commit the result.
如果你是git pull或者git push報fatal: refusing to merge unrelated histories
同理:
git pull origin master --allow-unrelated-histories
等等,就是這樣完美的解决
解決辦法來源:向小凯同学学习
Latest posts by pluto (see all)
- 解決 preact-router 資源請求路徑錯誤的問題 - 2022 年 6 月 24 日
- [楓之谷私服] 潮流轉蛋機 NPC 腳本優化 - 2022 年 6 月 19 日
- [楓之谷私服] 簡單的飛天椅子(坐騎)改法 v120 - 2022 年 6 月 19 日