'Recursively clone submodules from GitHub using an access token
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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mattias Arro |