I wrote it up here, if that sounds useful: https://www.brantonboehm.com/code/conditional-git-config/
Conditional Git Configuration
41–50 of 73 posts
Re: Conditional Git Configuration
#42Oh 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!
What do you have in your git config that requires switching over host architecture?
Re: Conditional Git Configuration
#43[1]: https://chezmoi.io/
[2]: https://github.com/cglong/dotfiles/blob/ea33143679e936f4043a...
Re: Conditional Git Configuration
#44Re: Conditional Git Configuration
#45Interesting, but why not just configure direnv to set appropriate env vars based on your current directory? That works for more than just git.
Re: Conditional Git Configuration
#46Something 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
#47I use virtual machines for development.
Re: Conditional Git Configuration
#48Re: Conditional Git Configuration
#49Can different .git-credentials files also be loaded conditionally? When one uses https access with multiple accounts....
Re: Conditional Git Configuration
#50Earlier quoted context omitted.
What do you have in your git config that requires switching over host architecture?
I put those there as a way to show I couldn't just switch on $ARCH or $OSTYPE similar. I should have explained that better, sorry about that.