如何修复 'git submodule add' 错误:'...' does not have a commit checked out
如果你尝试添加 git 子模块,但不断收到关于它没有检出提交的错误,例如
git_submodule_fix.sh
$ git submodule add --force -- https://github.com/filipecarneiro/hugo-bootstrap-theme themes/hugo-bootstrap-theme
Reactivating local git directory for submodule 'themes/hugo-bootstrap-theme'
error: 'themes/hugo-bootstrap-theme/' does not have a commit checked out
fatal: adding files failed
fatal: Failed to add submodule 'themes/hugo-bootstrap-theme问题可能不在远程仓库,而是你的本地仓库或你尝试添加的仓库使用了不同的哈希算法(SHA-1 与 SHA-256)。
目前,只有当子模块使用与本地仓库相同的哈希算法时才能添加子模块。
Check out similar posts by category:
Git
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow