Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid re-entering password for each submodule

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.

like image 220
M.M Avatar asked May 12 '15 02:05

M.M


People also ask

How do I ignore submodule changes?

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.

What recurse submodules?

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.

How do I change individual submodule?

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.

Is git submodule a good idea?

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.


1 Answers

Solution that requires much less headache

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'
like image 170
Stas Soroka Avatar answered Oct 06 '22 00:10

Stas Soroka