Reputation: 97
I have an umbrella repo containing a number of submodules. I am using
git clone --recurse-submodules --remote-submodules https://<access_token>@github.com/user/repo.git
to recursively clone all submodules. On Ubuntu, I am asked for the credentials of each submodule although they all can be accessed using the same access token, which I have tested by cloning them individually. Side note: I am asked for username and password, which have not been accepted anymore by GitHub since August, 13th. On Windows, where Git was installed as part of Visual Studio, I only need to provide the access token once for the umbrella repo.
I already tried to use the Git credential cache, but that did not work:
git config --global credential.helper cache
How can I clone the submodules recursively with providing the access token only once?
Upvotes: 6
Views: 7868
Reputation: 1122
You can do
git config --system credential.helper store
echo "https://username:[email protected]" > ~/.git-credentials
git clone --recurse-submodules https://github.com/org/repo repo
Now cloning the main repo and submodules from github.com will use this token.
Upvotes: 7