Git push 處理報錯:remote: error: cannot lock ref 'refs/heads/master': Unable to create '/var/opt/gitlab/git-data-file11/repositories/tomfriwel/test.git/./refs/heads/master.lock': File exists.

報錯與處理過程:

$ git push
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 2.78 KiB | 0 bytes/s, done.
Total 21 (delta 14), reused 0 (delta 0)
remote: error: cannot lock ref 'refs/heads/master': Unable to create '/var/opt/gitlab/git-data-file11/repositories/tomfriwel/test.git/./refs/heads/master.lock': File exists.
remote: 
remote: Another git process seems to be running in this repository, e.g.
remote: an editor opened by 'git commit'. Please make sure all processes
remote: are terminated then try again. If it still fails, a git process
remote: may have crashed in this repository earlier:
remote: remove the file manually to continue.
To gitlab.com:tomfriwel/test.git
 ! [remote rejected] master -> master (failed to update ref)
error: failed to push some refs to 'git@gitlab.com:tomfriwel/test.git'
$ rm -f /var/opt/gitlab/git-data-file11/repositories/tomfriwel/test.git/./refs/heads/master.lock
$ git push

將報錯中提示的文件刪除,再push就行了。

參考:
fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容