# [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig

26 messages from 2012-05-25 to 2012-05-26. Participants: nguyenhu@minatec.inpg.fr, Jonathan Nieder, Matthieu Moy, Hilco Wijbenga, Junio C Hamano, Jeff King, Felipe Contreras, Heiko Voigt.
Thread: https://gitlist.dev/t/30620

## nguyenhu@minatec.inpg.fr, 2012-05-25 16:15

Subject: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525181526.Horde.VibLf3wdC4BPv7AeKacSMiA@webmail.minatec.grenoble-inp.fr>
URL: https://gitlist.dev/e/20120525181526.Horde.VibLf3wdC4BPv7AeKacSMiA%40webmail.minatec.grenoble-inp.fr

```
Hello,

As you know, git stores its configuration in ~/.gitconfig file and in  
other hidden files at the root of the user's directory.

We would like to have a configuration directory instead of all these  
configuration files by following the XDG specification because:
- not a lot of hidden files at the root, so better view
- one directory per software in ~/.config

We would like to give to users the possibility to store configuration  
in ~/.config/git/config file.

git would store its configuration in ~/.config/git/config file if:
- this file exists,
- and ~/.gitconfig file doesn't.
Otherwise git would store its configuration in ~/.gitconfig as usual.

If you don't create ~/.config/git/config, there is no change.

What do you think about it ?

I will send you a patch today.

Thanks,

Lucien KONG,
Valentin DUPERRAY,
Huynh Khoi Nguyen NGUYEN,
Thomas NGUY,
Franck JONAS

Grenoble INP ENSIMAG

```

## Jonathan Nieder, 2012-05-25 17:01

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525170159.GA4086@burratino>
URL: https://gitlist.dev/e/20120525170159.GA4086%40burratino
In-Reply-To: <20120525181526.Horde.VibLf3wdC4BPv7AeKacSMiA@webmail.minatec.grenoble-inp.fr>

```
Hi,

nguyenhu@minatec.inpg.fr wrote:

> As you know, git stores its configuration in ~/.gitconfig file and
> in other hidden files at the root of the user's directory.
[...]
> git would store its configuration in ~/.config/git/config file if:
> - this file exists,
> - and ~/.gitconfig file doesn't.
> Otherwise git would store its configuration in ~/.gitconfig as usual.

Sounds like a worthwhile goal, so I look forward to the patch. ;-)

What other hidden files at the root of the user's directory are you
talking about?

Curious,
Jonathan

```

## Matthieu Moy, 2012-05-25 17:29

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpqvcjkrwxj.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqvcjkrwxj.fsf%40bauges.imag.fr
In-Reply-To: <20120525170159.GA4086@burratino>

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

> What other hidden files at the root of the user's directory are you
> talking about?

A typical user configuration (or at least mine ;-) ) can include:

[core]
	excludesfile = ~/.gitignore
	attributesfile = ~/.gitattributes

Not having a default value for these two variables is a bit painful. For
example, when I teach newbies not to version their *~ backup files, I'd
like to grab their keyboard and type for them

  echo '*~' >> ~/.gitignore

but right now, it takes a bit more time than that (which multiplied by
35 students in a room is not negligible ;-) ).

Actually, I now remember trying to find a default value some time ago:

  http://thread.gmane.org/gmane.comp.version-control.git/133343

The conclusion essentially boiled down to "let's drop the patch until
there's a clear consensus on what the default value should be", and
"don't default to ~/.gitsomething, because it will be painful to migrate
to a user config directory later".

Once it's official that the configuration is in stg like ~/.config/git/,
we can start thinking about a default value for core.excludesfile and
core.attributesfile, in the same directory (note: we're just talking
about default values here, so users having set the variable explicitely
won't be affected by the change).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Hilco Wijbenga, 2012-05-25 17:31

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <CAE1pOi0eY2=eNzuTUVGmHuvfGWvxoXSJUADWr0CfPpVe5ktxow@mail.gmail.com>
URL: https://gitlist.dev/e/CAE1pOi0eY2%3DeNzuTUVGmHuvfGWvxoXSJUADWr0CfPpVe5ktxow%40mail.gmail.com
In-Reply-To: <20120525181526.Horde.VibLf3wdC4BPv7AeKacSMiA@webmail.minatec.grenoble-inp.fr>

```
On 25 May 2012 09:15,  <nguyenhu@minatec.inpg.fr> wrote:
> Hello,
>
> As you know, git stores its configuration in ~/.gitconfig file and in other
> hidden files at the root of the user's directory.
>
> We would like to have a configuration directory instead of all these
> configuration files by following the XDG specification because:
> - not a lot of hidden files at the root, so better view
> - one directory per software in ~/.config
>
> We would like to give to users the possibility to store configuration in
> ~/.config/git/config file.

This is, of course, highly OS dependent. Ironically, I'd say we need a
setting in .gitconfig for it. :-)

There is also /etc(/default|/sysconfig|)/git/config to consider
(perhaps for some settings that should be the same for everyone).
Better yet, it would be nice if at least some settings could be part
of the repository itself (whitespace handling e.g.).

> git would store its configuration in ~/.config/git/config file if:
> - this file exists,
> - and ~/.gitconfig file doesn't.
> Otherwise git would store its configuration in ~/.gitconfig as usual.
>
> If you don't create ~/.config/git/config, there is no change.
>
> What do you think about it ?
>
> I will send you a patch today.
>
> Thanks,
>
> Lucien KONG,
> Valentin DUPERRAY,
> Huynh Khoi Nguyen NGUYEN,
> Thomas NGUY,
> Franck JONAS
>
> Grenoble INP ENSIMAG
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Jonathan Nieder, 2012-05-25 17:42

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525174237.GA4267@burratino>
URL: https://gitlist.dev/e/20120525174237.GA4267%40burratino
In-Reply-To: <CAE1pOi0eY2=eNzuTUVGmHuvfGWvxoXSJUADWr0CfPpVe5ktxow@mail.gmail.com>

```
Hi Hilco,

Hilco Wijbenga wrote:

> This is, of course, highly OS dependent. Ironically, I'd say we need a
> setting in .gitconfig for it. :-)
>
> There is also /etc(/default|/sysconfig|)/git/config to consider
> (perhaps for some settings that should be the same for everyone).
> Better yet, it would be nice if at least some settings could be part
> of the repository itself (whitespace handling e.g.).

The FILES section of git-config(1) might leave you happier. :)

Regarding $GIT_DIR/config, it says "The filename is of course relative
to the repository root, not the working directory.".  Is this out of
date?  (Cc-ing Peff and Duy.)

Jonathan

```

## Jonathan Nieder, 2012-05-25 17:44

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525174448.GB4267@burratino>
URL: https://gitlist.dev/e/20120525174448.GB4267%40burratino
In-Reply-To: <vpqvcjkrwxj.fsf@bauges.imag.fr>

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

>> What other hidden files at the root of the user's directory are you
>> talking about?
>
> A typical user configuration (or at least mine ;-) ) can include:
>
> [core]
> 	excludesfile = ~/.gitignore
> 	attributesfile = ~/.gitattributes

Ah, right, this line from .gitconfig: ;-)

	[core] excludesfile=~/.config/gitexcludes

[...]
> Actually, I now remember trying to find a default value some time ago:
>
>   http://thread.gmane.org/gmane.comp.version-control.git/133343
>
> The conclusion essentially boiled down to "let's drop the patch until
> there's a clear consensus on what the default value should be", and
> "don't default to ~/.gitsomething, because it will be painful to migrate
> to a user config directory later".
>
> Once it's official that the configuration is in stg like ~/.config/git/,
> we can start thinking about a default value for core.excludesfile and
> core.attributesfile, in the same directory (note: we're just talking
> about default values here, so users having set the variable explicitely
> won't be affected by the change).

Makes sense to me.

Thanks,
Jonathan

```

## Hilco Wijbenga, 2012-05-25 17:47

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <CAE1pOi3qSEY=Dj-Fqj+=anULVmCdsm72_k+B0SpdGiCO3u7L9A@mail.gmail.com>
URL: https://gitlist.dev/e/CAE1pOi3qSEY%3DDj-Fqj%2B%3DanULVmCdsm72_k%2BB0SpdGiCO3u7L9A%40mail.gmail.com
In-Reply-To: <20120525174237.GA4267@burratino>

```
On 25 May 2012 10:42, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Hilco,
>
> Hilco Wijbenga wrote:
>
>> This is, of course, highly OS dependent. Ironically, I'd say we need a
>> setting in .gitconfig for it. :-)
>>
>> There is also /etc(/default|/sysconfig|)/git/config to consider
>> (perhaps for some settings that should be the same for everyone).
>> Better yet, it would be nice if at least some settings could be part
>> of the repository itself (whitespace handling e.g.).
>
> The FILES section of git-config(1) might leave you happier. :)

Indeed!

> Regarding $GIT_DIR/config, it says "The filename is of course relative
> to the repository root, not the working directory.".  Is this out of
> date?  (Cc-ing Peff and Duy.)

I'm sure it's not. Somehow, I had gotten it in my head that this
wasn't possible. I am going to start using this right away. :-)
Thanks!

```

## Matthieu Moy, 2012-05-25 17:54

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpqipfkrvsx.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqipfkrvsx.fsf%40bauges.imag.fr
In-Reply-To: <20120525174237.GA4267@burratino>

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

> Regarding $GIT_DIR/config, it says "The filename is of course relative
> to the repository root, not the working directory.".  Is this out of
> date?  (Cc-ing Peff and Duy.)

This is a per-repository, but not "part of the repository" in the sense
"files tracked by Git" (i.e. it's not fetched by git clone).

Having a $GIT_WORKTREE/.gitconfig file would be very nice, but raises a
lot of security issues, so it's a much larger project (define which
configuration values are allowed there, possibly take them into account
at clone time, i.e. before checking out the files, and so on). Most
likely out of the scope of my students' project ;-).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jonathan Nieder, 2012-05-25 18:12

Subject: [PATCH] config doc: remove confusion about relative GIT_DIR from FILES section
Message-ID: <20120525181204.GA4491@burratino>
URL: https://gitlist.dev/e/20120525181204.GA4491%40burratino
In-Reply-To: <CAE1pOi3qSEY=Dj-Fqj+=anULVmCdsm72_k+B0SpdGiCO3u7L9A@mail.gmail.com>

```
From the FILES section of the git-config(1) manual:

	$GIT_DIR/config::
		Repository specific configuration file. (The filename is
		of course relative to the repository root, not the working
		directory.)

That's confusing because $GIT_DIR really is relative to the working
directory.

	$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
	$ export GIT_DIR GIT_EDITOR
	$ git config --edit --local
	/home/jrn/src/git/Documentation
	editing .git/config

It turns out that the comment is a remnant from older days when the
heading said ".git/config" (which is indeed relative to the top of the
worktree).

It was only when the heading was changed to refer more precisely to
<git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
dot, 2007-09-14) that the parenthesis stopped making sense.  Remove
it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Hilco Wijbenga wrote:
> On 25 May 2012 10:42, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> Regarding $GIT_DIR/config, it says "The filename is of course relative
>> to the repository root, not the working directory.".  Is this out of
>> date?  (Cc-ing Peff and Duy.)
>
> I'm sure it's not.

You're right --- the current wording never made sense and is not an
example of accurate documentation going stale with later behavior
changes as I had suspected.  Sorry for the noise.

Thanks,
Jonathan

 Documentation/git-config.txt |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 3f5d216a..d9463cb3 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -198,9 +198,7 @@ If not set explicitly with '--file', there are three files where
 'git config' will search for configuration options:
 
 $GIT_DIR/config::
-	Repository specific configuration file. (The filename is
-	of course relative to the repository root, not the working
-	directory.)
+	Repository specific configuration file.
 
 ~/.gitconfig::
 	User-specific configuration file. Also called "global"
-- 
1.7.10

```

## Junio C Hamano, 2012-05-25 18:13

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <7v4nr4t9gc.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4nr4t9gc.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CAE1pOi0eY2=eNzuTUVGmHuvfGWvxoXSJUADWr0CfPpVe5ktxow@mail.gmail.com>

```
Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:

> This is, of course, highly OS dependent. Ironically, I'd say we need a
> setting in .gitconfig for it. :-)
>
> There is also /etc(/default|/sysconfig|)/git/config to consider
> (perhaps for some settings that should be the same for everyone).
> Better yet, it would be nice if at least some settings could be part
> of the repository itself (whitespace handling e.g.).

As long as we make sure we have knobs for distro packagers and people
building from the source to twist so that they can easily name the places
they want us to read from and write to, what we decide in-tree does not
matter.  We default to ~/.gitconfig and /etc/gitconfig as before, and that
is perfectly fine.  We already have ETC_GITCONFIG, so the only thing it
might be nicer to add is the build configurability of ~/.gitconfig file,
no?

```

## Junio C Hamano, 2012-05-25 18:20

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <7vwr40rukg.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwr40rukg.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CAE1pOi3qSEY=Dj-Fqj+=anULVmCdsm72_k+B0SpdGiCO3u7L9A@mail.gmail.com>

```
Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:

>> Regarding $GIT_DIR/config, it says "The filename is of course relative
>> to the repository root, not the working directory.".  Is this out of
>> date?  (Cc-ing Peff and Duy.)

It is only worded awkwardly, I think.  The above is merely trying to say
that you do not place 'config' anywhere in the working tree; in other
words, "repository" in the above refers to GIT_DIR, and the "root" means
not inside refs/, objects/, or anywhere, just next to index, HEAD, etc.

```

## Jonathan Nieder, 2012-05-25 18:25

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525182558.GC4491@burratino>
URL: https://gitlist.dev/e/20120525182558.GC4491%40burratino
In-Reply-To: <7v4nr4t9gc.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:

>                     We already have ETC_GITCONFIG, so the only thing it
> might be nicer to add is the build configurability of ~/.gitconfig file,
> no?

If we were trying to solve a different problem ("my filesystem does
not support filenames starting with '.' with more than three
characters afterward") then I would agree, but in this case no.  HOME
directories are often shared between multiple machines, even machines
with different operating systems.

If I understand correctly, the proposal that started this thread was
to give people a chance to tidy their HOME directory by moving
personal git configuration under ~/.config/git/.  Git would detect it
automatically.  I think the main complication would be phasing in the
change slowly and carefully so people helping each other with git
problems do not get confused:

  "Why is this setting not taking effect?  It's in ~/.config/gitconfig
   just like it should be.  Oh, what git version do you have?"

and

  "Is there no .gitconfig?  Okay, we can assume all the default
   settings are in use.  Now let's..."

That's why I'd be happy to see how an initial patch approaches the
transition, to see how it can be improved to happen smoothly.

Jonathan

```

## Junio C Hamano, 2012-05-25 18:34

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <7vsjeortwu.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsjeortwu.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20120525182558.GC4491@burratino>

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

> If I understand correctly, the proposal that started this thread was
> to give people a chance to tidy their HOME directory by moving
> personal git configuration under ~/.config/git/.  

So it is exactly "I do not want ~/.gitconfig, I want ~/.config/git", no?

That is something distro should be able to decide.

```

## Jonathan Nieder, 2012-05-25 18:44

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525184408.GA4740@burratino>
URL: https://gitlist.dev/e/20120525184408.GA4740%40burratino
In-Reply-To: <7vsjeortwu.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:

>> If I understand correctly, the proposal that started this thread was
>> to give people a chance to tidy their HOME directory by moving
>> personal git configuration under ~/.config/git/.  
>
> So it is exactly "I do not want ~/.gitconfig, I want ~/.config/git", no?
>
> That is something distro should be able to decide.

Except that there is nothing distro-specific about it.  Do you really
want the config file to have a different name depending on whether one
is using Debian, Fedora, Mac OS X, Gentoo, one of the various builds of
git on Windows, Solaris, ...?

Besides, with my distro package maintainer hat on, I can tell you that
switching the config file to ~/.config/git and not reading
~/.gitconfig would be a complete nonstarter.  That would mean that the
existing user configuration for everyone would just seem to disappear.

Once the code to read both files is written, why would one want that
to be distro-specific and not something shared?

Hoping that clarifies a little,
Jonathan

```

## Junio C Hamano, 2012-05-25 18:58

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <7vobpcrstn.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vobpcrstn.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20120525184408.GA4740@burratino>

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

>> So it is exactly "I do not want ~/.gitconfig, I want ~/.config/git", no?
>>
>> That is something distro should be able to decide.
>
> Except that there is nothing distro-specific about it.  Do you really
> want the config file to have a different name depending on whether one
> is using Debian, Fedora,...

Not me personally.  But distros want to do that, it's their choice.

> Besides, with my distro package maintainer hat on, I can tell you that
> switching the config file to ~/.config/git and not reading
> ~/.gitconfig would be a complete nonstarter.

Absolutely.  So don't choose to deliberately introduce backward
incompatibliity.  Problem solved.

Why is it bad to keep using ~/.gitconfig in the first place?  The UNIX
convention to exclude names that begin with dot is not working for you?

```

## Matthieu Moy, 2012-05-25 19:01

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpqipfkozjm.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqipfkozjm.fsf%40bauges.imag.fr
In-Reply-To: <20120525184408.GA4740@burratino>

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

> Junio C Hamano wrote:
>> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>>> If I understand correctly, the proposal that started this thread was
>>> to give people a chance to tidy their HOME directory by moving
>>> personal git configuration under ~/.config/git/.  
>>
>> So it is exactly "I do not want ~/.gitconfig, I want ~/.config/git", no?
>>
>> That is something distro should be able to decide.
>
> Except that there is nothing distro-specific about it.  Do you really
> want the config file to have a different name depending on whether one
> is using Debian, Fedora, Mac OS X, Gentoo, one of the various builds of
> git on Windows, Solaris, ...?

I agree. Please don't encourage distro to make incompatible
configuration changes.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Matthieu Moy, 2012-05-25 19:13

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpq396ooyzd.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpq396ooyzd.fsf%40bauges.imag.fr
In-Reply-To: <7vobpcrstn.fsf@alter.siamese.dyndns.org>

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

>> Besides, with my distro package maintainer hat on, I can tell you that
>> switching the config file to ~/.config/git and not reading
>> ~/.gitconfig would be a complete nonstarter.
>
> Absolutely.  So don't choose to deliberately introduce backward
> incompatibliity.  Problem solved.

It doesn't have to be backward incompatible. The proposal is to _allow_
users to have a ~/.config/git/config file, not to _force_ them to have
one.

If Git reads both files, then ~/.gitconfig lovers can continue with it,
and are not affected.

> Why is it bad to keep using ~/.gitconfig in the first place?  The UNIX
> convention to exclude names that begin with dot is not working for you?

The "It's a convention" argument doesn't work here. XDG is also a rather
widely used convention these days, so "why not follow the convention"
can be used both in favor of ~/.gitconfig or ~/.config/git/config.

~/.gitconfig alone would not be a huge problem, although personnally
hate it already. I like to version my handwritten configuration files,
but I don't want my $HOME to be a git repository. I already have a
~/etc/ directory with my configuration files in it, and ~/.gitconfig is
basically a symbolic link. I wouldn't have to re-structure my $HOME if I
had a structured and standard configuration directory like ~/.config.

Now, the real issue is that we're starting to have several user-wide
config files (core.excludesfile, core.attributesfile, maybe one day
we'll want others like user-wide hooks?), and having multiple
~/.git<something> really feels wrong. Just like we have /etc/<file> for
applications that have only one configuration file, and /etc/<directory>
for ones who need more, it seems sensible to have a configuration
directory for a user, not just a set of configuration files in $HOME.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jonathan Nieder, 2012-05-25 19:17

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525191701.GA4944@burratino>
URL: https://gitlist.dev/e/20120525191701.GA4944%40burratino
In-Reply-To: <7vobpcrstn.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:

> Why is it bad to keep using ~/.gitconfig in the first place?  The UNIX
> convention to exclude names that begin with dot is not working for you?

Ok, now you're making more sense. :)

I don't think anyone was proposing dropping support for .gitconfig.
But:

Any patch to add support for ~/.config/git should of course take care
to include a rationale that answers this question.  (I am guessing
that putting all user git configuration in one directory is part of
the goal, and separating temporary files like ~/.fontconfig/*.cache*
from configuration files like ~/.mutt/muttrc is another part.)

Ciao,
Jonathan

```

## Matthieu Moy, 2012-05-25 19:29

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpqvcjknjo0.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqvcjknjo0.fsf%40bauges.imag.fr
In-Reply-To: <20120525191701.GA4944@burratino>

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

> I am guessing
> that putting all user git configuration in one directory is part of
> the goal, and separating temporary files like ~/.fontconfig/*.cache*
> from configuration files like ~/.mutt/muttrc is another part.

That's another good thing with XDG (~/.config Vs ~/.cache/ for example),
but I don't think Git would have anything user-wide that would not be
configuration.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jonathan Nieder, 2012-05-25 19:35

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525193507.GA5184@burratino>
URL: https://gitlist.dev/e/20120525193507.GA5184%40burratino
In-Reply-To: <vpqvcjknjo0.fsf@bauges.imag.fr>

```
Matthieu Moy wrote:

> That's another good thing with XDG (~/.config Vs ~/.cache/ for example),
> but I don't think Git would have anything user-wide that would not be
> configuration.

Of course, but your home directory that you read with "ls -A" does.
Putting configuration in ~/.config makes it easier to find amid all
that noise.

That said, as Junio wrote before[1]:

> It is not _too_ bad to treat ~/.gitconfig specially and support reading
> from ~/.$SOMEGITTTYNAME/{excludes,attributes} files.

That's what vim does --- its main configuration file is ~/.vimrc, and
there are also some supporting files in ~/.config/vim/.

Wouldn't that be a good place to start?

Jonathan

[1] http://thread.gmane.org/gmane.comp.version-control.git/133343/focus=135921

```

## Jonathan Nieder, 2012-05-25 19:37

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525193724.GB5184@burratino>
URL: https://gitlist.dev/e/20120525193724.GB5184%40burratino
In-Reply-To: <20120525193507.GA5184@burratino>

```
Jonathan Nieder wrote:
>            as Junio wrote before[1]:

>> It is not _too_ bad to treat ~/.gitconfig specially and support reading
>> from ~/.$SOMEGITTTYNAME/{excludes,attributes} files.
>
> That's what vim does --- its main configuration file is ~/.vimrc, and
> there are also some supporting files in ~/.config/vim/.
>
> Wouldn't that be a good place to start?

Correction: I meant "also some supporting files in ~/.vim/".

Sorry for the noise.
Jonathan

```

## Matthieu Moy, 2012-05-25 19:39

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <vpqr4u8nj7m.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqr4u8nj7m.fsf%40bauges.imag.fr
In-Reply-To: <20120525193507.GA5184@burratino>

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

> Matthieu Moy wrote:
>
>> That's another good thing with XDG (~/.config Vs ~/.cache/ for example),
>> but I don't think Git would have anything user-wide that would not be
>> configuration.
>
> Of course, but your home directory that you read with "ls -A" does.
> Putting configuration in ~/.config makes it easier to find amid all
> that noise.

Yes. My sentence above was just replying to "separating temporary files"
(i.e. putting stuff in ~/.cache/), I over-quoted your message.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Jeff King, 2012-05-25 20:06

Subject: Re: [PATCH] config doc: remove confusion about relative GIT_DIR from FILES section
Message-ID: <20120525200631.GA4364@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120525200631.GA4364%40sigill.intra.peff.net
In-Reply-To: <20120525181204.GA4491@burratino>

```
On Fri, May 25, 2012 at 01:12:04PM -0500, Jonathan Nieder wrote:

> From the FILES section of the git-config(1) manual:
> 
> 	$GIT_DIR/config::
> 		Repository specific configuration file. (The filename is
> 		of course relative to the repository root, not the working
> 		directory.)
> 
> That's confusing because $GIT_DIR really is relative to the working
> directory.
> 
> 	$ GIT_DIR=.git GIT_EDITOR='pwd; echo editing'
> 	$ export GIT_DIR GIT_EDITOR
> 	$ git config --edit --local
> 	/home/jrn/src/git/Documentation
> 	editing .git/config
> 
> It turns out that the comment is a remnant from older days when the
> heading said ".git/config" (which is indeed relative to the top of the
> worktree).
> 
> It was only when the heading was changed to refer more precisely to
> <git dir>/config (see v1.5.3.2~18, AsciiDoc tweak to avoid leading
> dot, 2007-09-14) that the parenthesis stopped making sense.  Remove
> it.

Thanks for digging in the history for the answer.

> diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
> index 3f5d216a..d9463cb3 100644
> --- a/Documentation/git-config.txt
> +++ b/Documentation/git-config.txt
> @@ -198,9 +198,7 @@ If not set explicitly with '--file', there are three files where
>  'git config' will search for configuration options:
>  
>  $GIT_DIR/config::
> -	Repository specific configuration file. (The filename is
> -	of course relative to the repository root, not the working
> -	directory.)
> +	Repository specific configuration file.
>  
>  ~/.gitconfig::
>  	User-specific configuration file. Also called "global"

This makes a lot more sense to me.

Acked-by: Jeff King <peff@peff.net>

-Peff

```

## Jeff King, 2012-05-25 20:11

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120525201123.GB4364@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120525201123.GB4364%40sigill.intra.peff.net
In-Reply-To: <vpqipfkrvsx.fsf@bauges.imag.fr>

```
On Fri, May 25, 2012 at 07:54:06PM +0200, Matthieu Moy wrote:

> Having a $GIT_WORKTREE/.gitconfig file would be very nice, but raises a
> lot of security issues, so it's a much larger project (define which
> configuration values are allowed there, possibly take them into account
> at clone time, i.e. before checking out the files, and so on). Most
> likely out of the scope of my students' project ;-).

Yes, I have proposed it in multiple forms, and the discussion always
ends in "gross, it's too complex".

If you really want to do it, the recommended way at this point is:

  # review for any issues (1)
  less .gitconfig

  # assuming it's OK, copy into place (2)
  cp .gitconfig .git/config-from-upstream

  # include it
  git config include.path config-from-upstream

And then repeat steps (1) and (2) whenever you want to update from
upstream. That fixes not only the security issues, but also means that
you won't accidentally drop back to some antique bogus config when you
"git checkout $some_old_version".

-Peff

```

## Felipe Contreras, 2012-05-26 10:45

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <CAMP44s32GKrmXDND3_iO6CTOgHTfeuBeXYEOjcET5bBZ067pFQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s32GKrmXDND3_iO6CTOgHTfeuBeXYEOjcET5bBZ067pFQ%40mail.gmail.com
In-Reply-To: <20120525181526.Horde.VibLf3wdC4BPv7AeKacSMiA@webmail.minatec.grenoble-inp.fr>

```
On Fri, May 25, 2012 at 6:15 PM,  <nguyenhu@minatec.inpg.fr> wrote:

> As you know, git stores its configuration in ~/.gitconfig file and in other
> hidden files at the root of the user's directory.
>
> We would like to have a configuration directory instead of all these
> configuration files by following the XDG specification because:
> - not a lot of hidden files at the root, so better view
> - one directory per software in ~/.config
>
> We would like to give to users the possibility to store configuration in
> ~/.config/git/config file.

I like this, but it shouldn't be "~/.config", it should be $XDG_CONFIG_HOME.

-- 
Felipe Contreras

```

## Heiko Voigt, 2012-05-26 10:59

Subject: Re: [RFC] Possibility to choose ~/.config/git/config instead of ~/.gitconfig
Message-ID: <20120526105936.GA37540@book.hvoigt.net>
URL: https://gitlist.dev/e/20120526105936.GA37540%40book.hvoigt.net
In-Reply-To: <CAMP44s32GKrmXDND3_iO6CTOgHTfeuBeXYEOjcET5bBZ067pFQ@mail.gmail.com>

```
Hi,

On Sat, May 26, 2012 at 12:45:52PM +0200, Felipe Contreras wrote:
> On Fri, May 25, 2012 at 6:15 PM,  <nguyenhu@minatec.inpg.fr> wrote:
> 
> > As you know, git stores its configuration in ~/.gitconfig file and in other
> > hidden files at the root of the user's directory.
> >
> > We would like to have a configuration directory instead of all these
> > configuration files by following the XDG specification because:
> > - not a lot of hidden files at the root, so better view
> > - one directory per software in ~/.config
> >
> > We would like to give to users the possibility to store configuration in
> > ~/.config/git/config file.
> 
> I like this, but it shouldn't be "~/.config", it should be $XDG_CONFIG_HOME.

If we do that what about a fallback to .config for operating systems
that do not have XDG? E.g. Git for Windows would then also be able to
benefit from that.

Cheers Heiko

```
