Created
February 17, 2023 11:56
-
-
Save acodeninja/bc3bbd78d9dc50c8a8b84c7eda6073d0 to your computer and use it in GitHub Desktop.
Quickly switch between git profiles after cloning a new repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"acodeninja": { | |
"name": "Lawrence", | |
"email": "lawrence@...", | |
"signingkey": "...." | |
}, | |
"madetech": { | |
"name": "Lawrence Goldstien", | |
"email": "lawrence.goldstien@...", | |
"signingkey": "...." | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profile_name=$1 | |
git config user.name "$(cat ~/.gitprofiles.json | jq ".$profile_name.name" -j)" | |
git config user.email "$(cat ~/.gitprofiles.json | jq ".$profile_name.email" -j)" | |
git config user.signingkey "$(cat ~/.gitprofiles.json | jq ".$profile_name.signingkey" -j)" | |
echo "Name: $(git config user.name), Email: $(git config user.email)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment