gitでlockファイルのエラーが出た時にやったこと
gitでpullしようとしたら、以下のエラーが出た
1 2 3 4 5 6 7 8 9 |
<small>fatal: Unable to create '/XXXXX/.git/ORIG_HEAD.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. Completed with errors, see above </small> |
調べてみると、「lockファイルは同じgitリポジトリに対して同時に複数の操作を行われないように作られる」らしい。
確かにエラー内容を翻訳してみると、「別のgitプロセスがこのリポジトリで実行されているようです」と言われている。
別段そんなことはしてないんだけどなー。
該当のフォルダの中を見に行ってみる。
1 2 3 4 5 6 7 8 |
<small>$ cd /XXXXX/.git/ $ ls FETCH_HEAD description logs HEAD hooks objects ORIG_HEAD index packed-refs branches index.lock refs config info sourcetreeconfig </small> |
index.lockというファイルがあったので、削除してみる。
1 2 |
<small>$ rm index.lock </small> |
fetchして無事にpull出来るようになった。
しかし、index.lock? ORIG_HEAD.lockは??