I have a repo with 3 submodules. The repo and submodules are all on the same server, which I have ssh access to. The remote URLs are:
ssh://[email protected]/path/to/sub1.git
ssh://[email protected]/path/to/sub2.git
ssh://[email protected]/path/to/sub3.git
If I do an operation such as git submodule update --remote
then it prompts for my password 3 times.
Is there any way to update the submodules but only require password once? Same goes for committing changes etc.
If you set ignore = all, to get sane behavior with git commit -a, it will ALSO ignore the submodule in git show/diff when you EXPLICITLY add them. The only way to work-around the latter is using the command line option --ignore-submodule=none.
If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. Using the “–remote” command, you will be able to update your existing Git submodules without having to run “git pull” commands in each submodule of your project.
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
Another approach is to use built-in git cache (v. 1.7.10 or newer required) so git will remember your login and password after you provide it first time.
To enable git cache with default timeout (15 min) you type
git config --global credential.helper cache
To change default timeout type
git config --global credential.helper 'cache --timeout=3600'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With