git: A git directory for 'xxxx' is found locally with remote(s)
2024/1/7
AI
問題
❯ git submodule add https://github.com/volantis-x/hexo-theme-volantis .\themes\volantis
fatal: A git directory for 'themes/volantis' is found locally with remote(s):
origin https://github.com/volantis-x/hexo-theme-volantis
If you want to reuse this local git directory instead of cloning again from
https://github.com/volantis-x/hexo-theme-volantis
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.
解決策
.git/moduleに対応のフォルダを削除する
❯ rm -r .\.git\modules\themes\volantis\
原因
前回のgit submodule addで追加しでも、ダウンロードは完全しなく、途中で中断した可能性がある。こうして、.git/modulesにthemes/volantisフォルダがキャッシュとして残っても、目標のフォルダthemes/volantisが作成されなかった。