git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 'git submodule update' ignores [http] config

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 10, 2018, 03:06 UTC
Message-ID
<20180810030624.GA101965@aiede.svl.corp.google.com>
In-Reply-To
<CAPFHKzepqebXX7mrbeoc=+SHzWZ5N+6eOaLiC26tVGKogZoLGg@mail.gmail.com>

+cc: Stefan, who has been looking at fetch --recurse-submodules recently Hi,

Jonathon Reinhart wrote:
Show 11 quoted lines
> I've narrowed it down to an observation that the [http] config seems
> to be ignored by 'git submodule update'. Shouldn't those options be
> respected by submodules?
>
> Given a .git/config file like this:
>
> ------------------------------------------------------------------------
> [fetch]
>     recurseSubmodules = false
> [http "https://gitlab.exmaple.com"]
>     sslCAInfo = C:\\Users\\gitlab-runner\\builds\\deadbeef\\0\\somegroup\\someproj.git\\CA_SERVER_TLS_CA_FILE
[...]
> C:\Users\jreinhart\testrepo>set GIT_CURL_VERBOSE=1
> C:\Users\jreinhart\testrepo>git fetch
[...]
> *   CAfile: C:\Users\gitlab-runner\builds\deadbeef\0\somegroup\someproj.git\CA_SERVER_TLS_CA_FILE
[...]
> C:\Users\jreinhart\testrepo>git checkout master
> C:\Users\jreinhart\testrepo>git submodule update --init
[...]
> *   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
[...]
> Note that the CAfile reverted to its default instead of using the same
> one from the `git fetch`.
Interesting.

The context is that "git submodule update" is simply running commands like "git fetch" inside the submodules, and the repository-local config of the superproject does not apply there.

In the long run, commands like "git fetch --recurse-submodules" may chaange to use a single process. It's possible that some of the repository-local configuration of the superproject would apply at that point, though the inconsistency would be confusing, so probably not these particular settings. Anyway, that's a faraway future; today, "git fetch --recurse-submodules" is also running "git fetch" commands inside the submodules, and the repository-local config of the superproject does not apply there.

Would it work for you to put this configuration in the global config file ("git config --global --edit")? That way, it would be used by all repositories. If you want it only to apply within the testrepo directory, you can use conditional includes --- something like:

  in $HOME/.git/config/testrepo-ca:
  [http "https://gitlab.example.com"]
  	sslCAInfo = ...
  in $HOME/.git/config/git:
  [includeIf "gitdir/i:~/testrepo/**"]
  	path = testrepo-ca

Thanks and hope that helps, Jonathan

Previous: Jonathon ReinhartNext: Jonathon Reinhart
Message 2 of 3 in “'git submodule update' ignores [http] config”
  1. Jonathon ReinhartAug 9, 2018
  2. Jonathan NiederAug 10, 2018
  3. Jonathon ReinhartAug 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.