1. 程式人生 > 其它 >git did not exit cleanly (exit code 1) 的解決辦法

git did not exit cleanly (exit code 1) 的解決辦法

技術標籤:gitgit

git did not exit cleanly的解決辦法

git did not exit cleanly (exit code 1) 的解決辦法

問題描述 :

關於Git的使用,相信大家平時都比較普遍用Git來做專案程式碼的管理 , 偶爾會有一些錯誤的操作會導致Git報錯 , 這樣問題就來了。

具體錯誤資訊如下:

git.exe push --progress "origin" master

To https://github.com/Jackson-AndyLau/CMSManager.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Jackson-AndyLau/CMSManager.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: '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) (12359 ms @ 2018-07-01 09:41:24)

如下圖所示:

解決辦法:
關於這個問題,在網上搜羅了一下,很多工程師都遇到過,解決方法也是五花八門,要不刪除一些檔案,要不修改一些配置檔案,個人感覺有點麻煩 .
比較簡單易懂方便的方法 , 可以新建目錄 , 克隆git倉庫目錄 , 把新克隆下來的 .git 檔案複製到原目錄替換原目錄的 .git 檔案即可 . 此問題可以理解為 .git 檔案記錄錯誤問題 , 恢復 .git 檔案即可正常使用 , 親測有用