Distributed backend specialist. Perfectly happy playing second fiddle—it means I get to chase fun ideas, dodge meetings, and break things no one told me to touch, all without anyone questioning it. 😇
This a great overview, thanks! Have you ever worked with the includeIf config option? I've found that it's sometimes easier to work with (although not as streamlined as your approach).
The tradeoff for me is I can work in either my git_work or git_personal directories with the exact same commands. Git handles the context switching for me based on the includeIf setting, which pulls a sub-config file based on the repo's directory location. If you're only supporting two, it's not a terrible setup. I have one common config plus two separate sub-configs each with a different email address, gpgKey, and ssh command (the later really just points to the right ssh key).
Yes I did use to combine .gitconfig file with the ssh config file in the past.
ssh config file to actually determine which ssh key to use
.gitconfig file with the includeif setting to configure the git username and email to commit and push the code into respective repo.
BTW I am not sure if you can specify the particular ssh key to use with different git remote URLs, just with the .gitconfig file.
I'd be fascinated to learn if this has changed now tho.
Distributed backend specialist. Perfectly happy playing second fiddle—it means I get to chase fun ideas, dodge meetings, and break things no one told me to touch, all without anyone questioning it. 😇
You may be correct about using it with different remotes. The git config core.sshCommand "ssh -i ~/.ssh/id_rsa_account" I have setup works for the one remote having different accounts.
I'm curious about it now, too! I had to stop myself from going on a treasure hunt knowing I still have about a billion other things that still need to be finished tonight! 😆
Thanks again for the article!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This a great overview, thanks! Have you ever worked with the
includeIfconfig option? I've found that it's sometimes easier to work with (although not as streamlined as your approach).The tradeoff for me is I can work in either my
git_workorgit_personaldirectories with the exact same commands. Git handles the context switching for me based on theincludeIfsetting, which pulls a sub-config file based on the repo's directory location. If you're only supporting two, it's not a terrible setup. I have one common config plus two separate sub-configs each with a different email address, gpgKey, and ssh command (the later really just points to the right ssh key).Hey Ashley. Thanks for the comment.
Yes I did use to combine
.gitconfigfile with the ssh config file in the past.ssh config file to actually determine which ssh key to use
.gitconfigfile with theincludeifsetting to configure the git username and email to commit and push the code into respective repo.BTW I am not sure if you can specify the particular ssh key to use with different git remote URLs, just with the
.gitconfigfile.I'd be fascinated to learn if this has changed now tho.
You may be correct about using it with different remotes. The
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_account"I have setup works for the one remote having different accounts.I'm curious about it now, too! I had to stop myself from going on a treasure hunt knowing I still have about a billion other things that still need to be finished tonight! 😆
Thanks again for the article!