[研究]Git commit 出現 git did not exit cleanly (exit code 1) 問題之解決
2022-03-17
git.exe push --progress "origin" master:master To http://網址IP:3000/路徑/專案.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'http://網址IP:3000/路徑/專案.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. git did not exit cleanly (exit code 1) (1375 ms @ 日期時間) |
Dealing with non-fast-forward errors - GitHub Docs
https://docs.github.com/en/get-started/using-git/dealing-with-non-fast-forward-errors
********************************************************************************
原因:
一般這是多人開發,大家同樣簽出 (checkout) 同一版本,有人比你早簽入 (checkin),你再簽入時發生。
解決:
假設敝人Git專案放自己 D:\Git\Project1 目錄,敝人不擅 Git 命令,所以是用GUI工具。
TortoiseGit – Windows Shell Interface to Git
https://tortoisegit.org/
WinMerge - You will see the difference…
https://winmerge.org/
測試1. Git Clone 把 Git Server 上的clone 到自己電腦 D:\Git\Project2 目錄,用 WinMerge 軟體比對,把 Project2 中較新的檔案拷貝到 Project1後,再把Project1目錄 Git Commit,結果,失敗。
測試2. 把 D:\Git\Project1 改名 D:\Git\Project1.New,Git Clone 把 Git Server 上的clone 到自己電腦 D:\Git\Project1 目錄,用 WinMerge 軟體比對,把 D:\Git\Project1.New中較新的檔案拷貝到 Project1後,再 Git Commit,結果,成功。
(完)
沒有留言:
張貼留言