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

Re: Configuring the location of ~/.gitconfig

From
APAnurag Priyam <anurag08priyam@gmail.com>
Date
Sep 27, 2012, 06:40 UTC
Message-ID
<CAD1m08Wz7WqP8Yxgc6xuhBSntQ0PS6hGOzHWrcd0VAbARmkuUA@mail.gmail.com>
In-Reply-To
<7v6270t2tb.fsf@alter.siamese.dyndns.org>
On Thu, Sep 27, 2012 at 11:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> I'd like to configure the location of ~/.gitconfig through an
>> environment variable.  My usecase is a simple enough: I have a
>> repository with all my dotfiles, and I don't want to symlink
>> ~/dotfiles/.gitconfig from $HOME after cloning it.  Does anyone else
>> think the feature will be useful?
>
> Not me. For that particular use case, my approach (long before I
> switched the vcs that controls my dotfiles to git) have always been
> to have ~/src that is version controlled, with a Makefile that
> builds/adjusts dotfiles appropriately for each box and installs them
> in the proper place.

Makefile is what I wanted to avoid when I suggested Ram that maybe Git could _optionally_ read the location of global gitconfig from an environment variable that can be exported in zshenv or bash_profile.

I don't think either way is the best way of managing dotfiles. Just a matter of preference. The environment variable approach doesn't require you to run `make` everytime you sync your dotfiles across different machines, and that is what I like.

Also, Git allows configuring the location of template directory via an environment variable (GIT_TEMPLATE_DIR). Since Git has already fixed the location of global gitconfig, it might as well read the location of template directory from there (init.templatedir). Why the added flexibility? Well, I have been exploiting the feature to manage git templates through my zsh configuration.

-- 
Anurag Priyam
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 14 in “Configuring the location of ~/.gitconfig”
  1. Ramkumar RamachandraSep 26, 2012
  2. David AguilarSep 26, 2012
  3. Ramkumar RamachandraSep 27, 2012
  4. config: introduce GIT_GLOBAL_CONFIG to override ~/.gitconfigRamkumar Ramachandra, Sep 27, 2012
  5. Matthieu MoySep 27, 2012
  6. Junio C HamanoSep 27, 2012
  7. Junio C HamanoSep 27, 2012
  8. Jeff KingSep 27, 2012
  9. Junio C HamanoSep 27, 2012
  10. Matthieu MoySep 27, 2012
  11. Ramkumar RamachandraSep 28, 2012
  12. Junio C HamanoSep 27, 2012
  13. Anurag PriyamSep 27, 2012
  14. Junio C HamanoSep 27, 2012

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.