How to fix 'git submodule add' error: '...' does not have a commit checked out

If you’re trying to add a git submodule, but you’re constantly getting errors about it not having a commit checked out, e.g.

$ 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

the issue is likely not with the remote repository but that either your local repo or the repo you’re trying to add is using a different hash algortihm (SHA-1 vs SHA-256).

Currently, you can only add a submodule if it uses the same hash algorithm as your local repository.