# Querying Git for the path to the system config file

3 messages from 2015-05-20 to 2015-05-20. Participants: Sebastian Schuberth, Jeff King.
Thread: https://gitlist.dev/t/39387

## Sebastian Schuberth, 2015-05-20 20:23

Subject: Querying Git for the path to the system config file
Message-ID: <CAHGBnuPCZCBsBXqGo26E-pcuZXZBxL8GwAehW4UziDpB2V8Npw@mail.gmail.com>
URL: https://gitlist.dev/e/CAHGBnuPCZCBsBXqGo26E-pcuZXZBxL8GwAehW4UziDpB2V8Npw%40mail.gmail.com

```
Hi,

I was in need to find out the path to the system-wide config file that
Git is using. I need to do this in a platform-independent way (Linux,
Mac OS X, Windows). What I came up with is

$ GIT_EDITOR=echo git config --system --edit

to trick Git into printing the path instead of opening the file in an editor.

Just wondering, is there a less hacky way to do that?

-- 
Sebastian Schuberth

```

## Jeff King, 2015-05-20 21:01

Subject: Re: Querying Git for the path to the system config file
Message-ID: <20150520210143.GC8421@peff.net>
URL: https://gitlist.dev/e/20150520210143.GC8421%40peff.net
In-Reply-To: <CAHGBnuPCZCBsBXqGo26E-pcuZXZBxL8GwAehW4UziDpB2V8Npw@mail.gmail.com>

```
On Wed, May 20, 2015 at 10:23:55PM +0200, Sebastian Schuberth wrote:

> I was in need to find out the path to the system-wide config file that
> Git is using. I need to do this in a platform-independent way (Linux,
> Mac OS X, Windows). What I came up with is
> 
> $ GIT_EDITOR=echo git config --system --edit
> 
> to trick Git into printing the path instead of opening the file in an editor.
> 
> Just wondering, is there a less hacky way to do that?

No, there isn't. It's baked in at compile-time, so something similar to
"git --exec-path" might make sense (but if we are going to start
exposing a lot of build flags, it might be nice to come up with some
organized system rather than haphazardly adding options).

Of course adding a new option probably won't help you, as it will take
some time before it can be used reliably. I think the hack you came up
with is pretty reasonable in the meantime.

-Peff

```

## Sebastian Schuberth, 2015-05-20 21:22

Subject: Re: Querying Git for the path to the system config file
Message-ID: <CAHGBnuOP_pZzZz_jJSG5YzhPp+=TEmy2n83YiH_uA3s56GWt-g@mail.gmail.com>
URL: https://gitlist.dev/e/CAHGBnuOP_pZzZz_jJSG5YzhPp%2B%3DTEmy2n83YiH_uA3s56GWt-g%40mail.gmail.com
In-Reply-To: <20150520210143.GC8421@peff.net>

```
On Wed, May 20, 2015 at 11:01 PM, Jeff King <peff@peff.net> wrote:

> Of course adding a new option probably won't help you, as it will take
> some time before it can be used reliably. I think the hack you came up
> with is pretty reasonable in the meantime.

Right, so I'll keep using that hack, thanks!

-- 
Sebastian Schuberth

```
