[git] git addで".git/index.lock': File exists."エラーが出たときにすべき事

カテゴリ: 未分類 | タグ:

gitを使っていて、git addやgit pushなどのコマンドを実行したとき、以下のような'.git/index.lock': File exists.エラーが出るときがあります。

$ git add *
fatal: Unable to create '/home/xxx/.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.

index.lockファイルは、同じgitリポジトリに対して同時に複数の操作を行わないよう、排他制御を行うためのロックファイルです。

対処方法

他のウィンドウやcronのバッチなどで、gitコマンドを実行している場合は、終了するまで待ちます。

以前にgitコマンドを実行していて強制終了させたなど、心当たりがある場合は、下記のように手動で.git/index.lockファイルを削除すれば大丈夫です

rm /home/xxx/.git/index.lock


Gitが、おもしろいほどわかる基本の使い方33


Amazonでおトクに買い物する方法
AmazonチャージでポイントGET


Amazonは買いもの前にAmazonギフト券をチャージしてポイントをゲットしないと損!

こちらもおススメ

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です