🦁

mac osで作ったリポジトリがWindowsでcloneできない

2023/07/17に公開

Windowsで最初にリモートリポジトリを作り、その後はmacとWindowsの両方で作業していた。
今回さらに違うWindowsPCで作業を始めようとcloneしようとしたらエラー発生。

$ git clone https://github.com/username/repository.git
Cloning into 'repository'...
remote: Enumerating objects: 1351, done.
remote: Counting objects: 100% (439/439), done.
remote: Compressing objects: 100% (309/309), done.
remote: Total 1351 (delta 92), reused 375 (delta 76), pack-reused 912
Receiving objects: 100% (1351/1351), 52.76 MiB | 25.28 MiB/s, done.
Resolving deltas: 100% (314/314), done.
error: invalid path '.metadata/.plugins/org.eclipse.core.runtime/.settings/org.springframework.ide.eclipse.boot.dash:Docker.prefs'
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 :/'

調べたところWindows, mac os, Linuxでファイルシステムの違いによるエラーらしい。

$ git config core.protectNTFS false

上記コマンドで違いがあっても無視するという設定に変更できる。
ただしこれはgitディレクトリの設定変更らしいので、clone段階の場合は下記によるグローバルな設定が必要。

$ git config --global core.protectNTFS false

Discussion