fetch origin error: cannot lock ref – Another git process seems to be running in this repository, e.g. an editor opened by ‘git commit’. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier

今日很䌓忙時候 我的Git / Source Tree 出現了以下的錯誤信息
可能是開了太多的ProjectLocal Branch 的關係

Another git process seems to be running in this repository

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
error: cannot lock ref ‘refs/remotes/origin/develop’: Unable to create ‘D:/Git/client-web/.git/refs/remotes/origin/develop.lock’: File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by ‘git commit’. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.”

解決方法十分簡單
我們只需要到這個Project 的 “.Git” 資料夾內
e.g.”/.git/refs/remotes/origin/

或出那個有 “.lock” Extension 的檔案.之後把他”刪除” 便可以了

Hope you find it useful

Leave a Reply