Re: Configuring the location of ~/.gitconfig
From: Anurag Priyam <hidden>
Date: 2016-06-15 22:54:52
On Thu, Sep 27, 2012 at 11:39 AM, Junio C Hamano [off-list ref] wrote:
Ramkumar Ramachandra [off-list ref] writes:quoted
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