Skip to content

Instantly share code, notes, and snippets.

@acodeninja
Created February 17, 2023 11:56
Show Gist options
  • Save acodeninja/bc3bbd78d9dc50c8a8b84c7eda6073d0 to your computer and use it in GitHub Desktop.
Save acodeninja/bc3bbd78d9dc50c8a8b84c7eda6073d0 to your computer and use it in GitHub Desktop.
Quickly switch between git profiles after cloning a new repo
{
"acodeninja": {
"name": "Lawrence",
"email": "lawrence@...",
"signingkey": "...."
},
"madetech": {
"name": "Lawrence Goldstien",
"email": "lawrence.goldstien@...",
"signingkey": "...."
}
}
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