git error fatal: Unable to create '<path>/.git/index.lock': File exists.

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Cloud、Server、および Data Center - この記事はすべてのプラットフォームに等しく適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

When running git commands, an error is displayed pointing to a file: .git/index.lock. 

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

If you are pushing to Bitbucket Cloud and get a similar error, but it is a remote error, please create a support ticket:

remote: error: cannot lock ref 'refs/heads/master':
Unable to create '<path>/./refs/heads/master.lock':
File exists. 

環境

Any git repository.

診断

When doing a local git write, like a git merge, you see the following error:

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

Make sure the error does not say 'remote error' and check to see if the file exists.   If the file does not exist, the git process that created the file finished and exited or this is not the right Knowledge Base Article to follow.

原因

Another git process is currently writing data to this repository. 

または 

A git process exited early and was not able to remove the file before exiting. This file is used to make sure two git process do not write at the same time.

ソリューション

This issue is a local error, it affects just this repository. Check in your OS to make sure no other git process are running.  If you can confirm no git process are running, you can remove the file with no issues.

最終更新日: 2024 年 1 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.