Conditional Git Configuration
11–20 of 73 posts
Re: Conditional Git Configuration
#12Re: Conditional Git Configuration
#13Re: Conditional Git Configuration
#14Oh nice, this will remove an annoyance in my dotfiles repo by letting me share my gitconfig between 3 different configurations (home linux amd64 box, work macOS arm64, client macOS arm64) Thank you for sharing it!
I just have a "config-private" file that I include in my main config, but I ignore it in the dotfiles repo. Git will ignore any included file if it does not exist. That lets me customize things locally without checking work details into version control.
Re: Conditional Git Configuration
#15Can different .git-credentials files also be loaded conditionally? When one uses https access with multiple accounts....
Re: Conditional Git Configuration
#16Something that wasn't addressed: when is the configuration read? Does this happen on every command-line git command execution? (I'm guessing "yes", but...)
Re: Conditional Git Configuration
#17What path should go into gitdir if the repos are at S:\Repos\ ?
Re: Conditional Git Configuration
#18You can also configure multiple ssh keys through Github subdomains in your ssh conf file. While github ignores the subdomain your ssh-client will pick the corresponding ssh key bas d on the used subdomain in your repo url.
Re: Conditional Git Configuration
#19Nice. For years I've been using [direnv]( https://direnv.net/ ) for this, setting environment variables which git picks up. This looks like a more feature complete equivalent, although to be honest I only really need switching of committer email and the SSH key used.
Re: Conditional Git Configuration
#20I wrote this about 3 or 4 years ago detailing exactly the same: https://www.leemeichin.com/posts/conditional-git-config.html