# 【Git】 fatal: Unable to create '.git/index.lock': File exists. の解決
> Git 操作を行おうとしたら fatal: Unable to create '.git/index.lock': File exists. が出たきたので解決方法メモ
- Canonical: https://c-a-p-engineer.github.io/git-fatal-index.lock/
- Published: 2022-04-07T17:00:00.000Z
- Modified: 2022-04-07T17:00:00.000Z
- Categories: Git
- Tags: Git

Git操作を行おうとしたら `fatal: Unable to create '.git/index.lock': File exists.` が出たきたので解決方法メモ

## エラー
`pull` などのGitの操作を行った際に発生。

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

## 原因
排他制御用のファイルが `.git/index.lock` が存在する。
そのため別にGitの操作が行われている。

## 解決方法
1. Git操作の終了を待つ
  思い当たるGitの操作があれば終了を待ってください。
2. `.git/index.lock` を削除
  該当プロジェクトの `.git/index.lock` を削除すれば解決します。

## 参考
<a href="https://stackoverflow.com/a/7860765" target="_blank" rel="nofollow noopener">Git - fatal: Unable to create &#39;/path/my_project/.git/index.lock&#39;: File exists - Stack Overflow</a>
