Why to Setup Your Git Submodules as https:// not ssh
I was pulling a public GitHub repo the other day which featured submodules. The frustrating problem is whenever I tried to init the submodules with the line
git submodule update --init --recursive I got the error Git Submodule fatal: Could not read from remote repository
This comment on Stack Overflow was the key to understanding the issue using a GitHub public url rather than using a public key.
I was cloning a public GitHub repo and the submodules were also public GitHub repos but I don’t use SSH authentication for GitHub, I use credential.helper osxkeychain and the submodule urls were using the format
firstname.lastname@example.org:mileszs/ack.vim.git rather than
https://github.com/mileszs/ack.vim.git. The former format requires you access GitHub via SSH, the later allows any public connection.
Please Setup Submodules Using Public URLs
The take-away from all of this is, please use public URLs (https://) not SSH (email@example.com:) when setting up your submodules.
Please Use this
git submodule add https://github.com/salcode/example.git
git submodule add firstname.lastname@example.org:salcode/example.git