iOSエンジニアのつぶやき

毎朝8:30に iOS 関連の技術について1つぶやいています。まれに釣りについてつぶやく可能性があります。

fatal: Unable to create '/.git/index.lock': File exists. 対処法

先日 Carthage/Build をソース管理から外そうと、gitignore を修正後 git rm -r --cached . してから git add . を実行すると下記のようなエラーに遭遇しました。

fatal: Unable to create '/.git/index.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.

解決法

プロジェクトのルートにて下記を実行することで解決しました🚀

$cd .git
$rm index.lock

エラー内容をみた感じだと、別の git プロセスでリポジトリ操作が行われていることに起因して発生しているみたいですが、どこで発生したのかが謎です。。

という感じで本日は以上になります🍺

その他の記事

yamato8010.hatenablog.com

yamato8010.hatenablog.com

yamato8010.hatenablog.com