I have to automate the cloning of a repository and fetching all its submodules. The URLs for the repository submodules are specified at .gitmodules
. If I were to go with defaults I would just do
git clone --recursive https://username:[email protected]
The problem is credentials aren't included in .gitmodules
file and I am prompted for those when I clone. I have to use HTTPS rather than SSH.
I tried to submit the credentials using git config:
git clone https://username:[email protected] my_repo
cd my_repo
git submodule init
git config submodule.my_submodule.url "https://username:password@url/my_submodule.git"
git submodule update
but I get prompted for credentials in the last update step. I've checked that the submodule URL is correct and has proper credentials in .git/config
file.
git submodule sync
? – Barnetmy_submole
. Got misled by tab completion. I found proper name in.gitmodules
. – Consumerism