LoginSignup
154
98

More than 5 years have passed since last update.

Gitでcommitとpull時にindex.lockのエラー

Posted at

windows環境でcommitを行おうとした際に下記エラーでcommitやpullできないとの報告があり調査。

fatal: Unable to create 'C:/path/to/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

エラー主さんで、.git/index.lock のファイルが存在しているため削除をしたみたいだが、また index.lock が復活してしまうとのこと。

確かに、いろいろ調べてみると、 .git/index.lock の削除で対応できそうな感じだけど、うまくいかない。

どうやら、.git/.COMMIT_EDITMSG.swp の削除で解決した人がいるらしいが、エラー主さんに確認してもらったところ、ファイルがない。
.git/COMMIT_EDITMSGファイルが存在するので、それを削除してもらったら解決した。

結果、 .git/index.lock.git/COMMIT_EDITMSG のファイル削除で解消。


参考サイト
* 困った&困っていること
* git commit したときにfatal: could not open '.git/COMMIT_EDITMSG': Permission denied が出た場合

154
98
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
154
98