はじめに
現在このリポジトリを新規クローンすると失敗することがあります。
その解決方法の共有です!
問題
以下のようなエラーが出た場合は、長いファイル名が含まれていることが原因である可能性が高いです。
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
または
open("{くっそ長いpath}"): Filename too long unable to index file '{くっそ長いpath}'
解決
このような状況となった場合、以下のどちらかで対応できます!
- 対象のディレクトリにおいて、git bash で
git config --local core.longpaths true
を実行(対象のディレクトリのみ設定変更) - git bash で
git config --system core.longpaths true
を実行(git for windows 全体の設定変更)
注意
git config --system core.longpaths true
は管理者権限で git bash を開かないと以下のようなエラーが出るため注意です!!
$ git config --system core.longpaths true
error: could not lock config file C:/Program Files/Git/etc/gitconfig: Permission denied
参考