threads / discuss / 30150

Question about include feature in .gitconfig

Subject: Question about include feature in .gitconfig

## tl;dr

2 messages between Apr 4, 2012 and Apr 4, 2012.

replies: 1people: 2as markdown or json

Shouichi KAMIYA· Apr 4, 2012, 21:09 UTC · lore
Hello git users and developers,

I have a question about "include" feature in config file. In .gitconfig I included .my_super_secret_file like below.

# .gitconfig
[include]
    path = .my_super_secret_file
# .my_super_secret_file
[github]
    password = foobar

Now, my question is return value of "git config --global github.password". I expect it to return foobar but it returns nothing. Is this behavior expected?

Cheers! Shouichi

-- 
Shouichi KAMIYA
Jeff King· Apr 4, 2012, 21:15 UTC · re: Shouichi KAMIYA · lore

Re: Question about include feature in .gitconfig

On Thu, Apr 05, 2012 at 06:09:41AM +0900, Shouichi KAMIYA wrote:
Show 13 quoted lines
> I have a question about "include" feature in config file.
> In .gitconfig I included .my_super_secret_file like below.
> 
> # .gitconfig
> [include]
>     path = .my_super_secret_file
> 
> # .my_super_secret_file
> [github]
>     password = foobar
> 
> Now, my question is return value of "git config --global github.password".
> I expect it to return foobar but it returns nothing. Is this behavior expected?

Yes, that's the expected behavior. Includes are not followed by default when you ask for the value from a _specific_ file, as you do with "--global".

If you do "git config github.password", you will get the answer you want. You can also use "git config --includes --global github.password" if you want to search only ~/.gitconfig, but following includes.

-Peff

← back to recent threads