# What means "git config bla ~/"?

6 messages from 2017-10-02 to 2017-10-04. Participants: rpjday@crashcourse.ca, René Scharfe, Jonathan Nieder, Junio C Hamano, Matthieu Moy.
Thread: https://gitlist.dev/t/46880

## rpjday@crashcourse.ca, 2017-10-02 10:13

Subject: What means "git config bla ~/"?
Message-ID: <20171002061303.Horde.SL92grZCqTRV9oQkBFPELQ7@crashcourse.ca>
URL: https://gitlist.dev/e/20171002061303.Horde.SL92grZCqTRV9oQkBFPELQ7%40crashcourse.ca

```
   i'm sure i'm about to embarrass myself but, in "man git-config",  
OPTIONS, one reads:

   --path

   git-config will expand leading ~ to the value of $HOME, and ~user  
to the   home directory for the specified user. This option has no  
effect when setting the value (but you can use git config bla ~/ from  
the command line to let your shell do the expansion).

   what's with that "git config bla ~/"? is this some config keyword  
or something?

rday


```

## René Scharfe, 2017-10-02 14:06

Subject: Re: What means "git config bla ~/"?
Message-ID: <dd28de03-9286-d5aa-3f00-9f6b7a85d71b@web.de>
URL: https://gitlist.dev/e/dd28de03-9286-d5aa-3f00-9f6b7a85d71b%40web.de
In-Reply-To: <20171002061303.Horde.SL92grZCqTRV9oQkBFPELQ7@crashcourse.ca>

```
[When I try to reply to rpjday@crashcourse.ca then my SMTP server
 says "Requested action not taken: mailbox unavailable
 invalid DNS MX or A/AAAA resource record.", so I'm replying only
 to the list.]

Am 02.10.2017 um 12:13 schrieb rpjday@crashcourse.ca:
> i'm sure i'm about to embarrass myself but, in "man git-config",
> OPTIONS, one reads:
> 
> --path
> 
> git-config will expand leading ~ to the value of $HOME, and ~user to
> the   home directory for the specified user. This option has no
> effect when setting the value (but you can use git config bla ~/ from
> the command line to let your shell do the expansion).
> 
> what's with that "git config bla ~/"? is this some config keyword or
> something?
"bla" represents any configuration option that you want to change.  It
is not literally a keyword recognized by git config.  You could replace
it with "foo", if that helps.

The comment in parentheses reminds readers that shells like bash do
tilde expansion for command line arguments.  Consider the following
command:

	$ git config format.outputDirectory ~/patches

Your shell rewrites "~/patches" to "/home/rpjday/patches" (or similar,
depending on your user name and home directory) before actually
executing git config. So even though git config doesn't expand ~ in
option values you'll still get a result like this afterwards:

	$ git config format.outputDirectory
	/home/rpjday/patches

René

```

## Jonathan Nieder, 2017-10-02 17:13

Subject: Re: What means "git config bla ~/"?
Message-ID: <20171002171300.GP19555@aiede.mtv.corp.google.com>
URL: https://gitlist.dev/e/20171002171300.GP19555%40aiede.mtv.corp.google.com
In-Reply-To: <20171002061303.Horde.SL92grZCqTRV9oQkBFPELQ7@crashcourse.ca>

```
Hi,

rpjday@crashcourse.ca wrote:

> i'm sure i'm about to embarrass myself but, in "man git-config",
> OPTIONS, one reads:
>
>   --path
>
> git-config will expand leading ~ to the value of $HOME, and ~user
> to the   home directory for the specified user. This option has no
> effect when setting the value (but you can use git config bla ~/
> from the command line to let your shell do the expansion).
>
> what's with that "git config bla ~/"? is this some config keyword
> or something?

No need to be embarrased.  Here "bla" is a placeholder.  That is,
for example, I can run

	git config --global include.path ~/.config/git/more-config

or

	git config --global include.path $HOME/.config/git/more-config

to cause

	[include]
		path = /home/me/.config/git/more-config

to be added to my global configuration.  The expansion of ~ or $HOME
is performed by my shell, not Git.  For comparison, if I had run

	git config --global include.path '~/.config/git/more-config'

then that would cause

	[include]
		path = ~/.config/git/more-config

to be added to my global configuration, but it would still have the
same effect at run time, since Git is also able to expand ~ to my home
directory.

The wording comes from

	commit 1349484e341a3ec2ba02a86c8fbd97ea9dc8c756
	Author: Matthieu Moy <Matthieu.Moy@imag.fr>
	Date:   Wed Dec 30 17:51:53 2009 +0100

	    builtin-config: add --path option doing ~ and ~user expansion.

I agree with you that it is less clear than it could be.  Ideas for
clarifying it?

Thanks,
Jonathan

```

## Junio C Hamano, 2017-10-03 00:08

Subject: Re: What means "git config bla ~/"?
Message-ID: <xmqqfub1m6u5.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqfub1m6u5.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20171002171300.GP19555@aiede.mtv.corp.google.com>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

>> what's with that "git config bla ~/"? is this some config keyword
>> or something?
> ...
>
> I agree with you that it is less clear than it could be.  Ideas for
> clarifying it?

Yeah, if it were

	git config section.var ~/some/thing

that would be far clearer than "bla" that what we see is a mere
placeholder.

Another obvious option is to remove the parenthetical comment.

Or "(but you can give values without quoting and let your shell
expand it)", without a confusing sample command that proved not to
help very much.




```

## Matthieu Moy, 2017-10-03 11:45

Subject: Re: What means "git config bla ~/"?
Message-ID: <1964024229.332266.1507031152104.JavaMail.zimbra@matthieu-moy.fr>
URL: https://gitlist.dev/e/1964024229.332266.1507031152104.JavaMail.zimbra%40matthieu-moy.fr
In-Reply-To: <xmqqfub1m6u5.fsf@gitster.mtv.corp.google.com>

```
"Junio C Hamano" <gitster@pobox.com> writes:

> Jonathan Nieder <jrnieder@gmail.com> writes:
> 
>>> what's with that "git config bla ~/"? is this some config keyword
>>> or something?
>> ...
>>
>> I agree with you that it is less clear than it could be.  Ideas for
>> clarifying it?
> 
> Yeah, if it were
> 
>	git config section.var ~/some/thing
> 
> that would be far clearer than "bla" that what we see is a mere
> placeholder.

Agreed.

> Another obvious option is to remove the parenthetical comment.
> 
> Or "(but you can give values without quoting and let your shell
> expand it)", without a confusing sample command that proved not to
> help very much.

I prefer your "section.var" proposal above. I think people who really understand shell quoting do not need the explanations, and others probably need the example.

While we're there, the formatting is also wrong ('' quoting, while we normally use `` quoting for shell commands).

Sounds like a nice microproject for my students :-). A patch should follow soon.

-- 
Matthieu Moy
https://matthieu-moy.fr/

```

## Junio C Hamano, 2017-10-04 04:01

Subject: Re: What means "git config bla ~/"?
Message-ID: <xmqqd163ftng.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqd163ftng.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <1964024229.332266.1507031152104.JavaMail.zimbra@matthieu-moy.fr>

```
Matthieu Moy <git@matthieu-moy.fr> writes:

> "Junio C Hamano" <gitster@pobox.com> writes:
>
>> Jonathan Nieder <jrnieder@gmail.com> writes:
>> 
>>>> what's with that "git config bla ~/"? is this some config keyword
>>>> or something?
>>> ...
>>	git config section.var ~/some/thing
>> ...
>
> I prefer your "section.var" proposal above. I think people who really understand shell quoting do not need the explanations, and others probably need the example.
>
> While we're there, the formatting is also wrong ('' quoting, while we normally use `` quoting for shell commands).
>
> Sounds like a nice microproject for my students :-). A patch should follow soon.

OK, thanks.  Lest we forget, this is #leftoverbits for now.

```
