Created
August 15, 2017 00:34
-
-
Save mtbiker-s/b309cf51cdd06ce86241e81f95f2e4bd to your computer and use it in GitHub Desktop.
BASH Script to change your git profile from your work profile to your personal GH profile or vice versa.
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
#!/bin/bash | |
# That is for OSX | |
# For *nix use #!/usr/bin/bash | |
echo "Switching git user profile" | |
echo | |
echo "Curent git profile" | |
git config -l | |
echo "Please enter which profile to use 'work' or 'personal'" | |
read profileToUse | |
if [[ $profileToUse == "work" ]]; then | |
echo "Setting git profile to access github.work.com" | |
# Don't forget to change these 2 lines | |
git config --global user.email "your_address@work.com" | |
git config --global user.name "your_work_github_username" | |
else | |
echo "Setting git profile to access github.com" | |
# Don't forget to change these 2 lines | |
git config --global user.email "your_address@personal.email.com" | |
git config --global user.name "your_git_hub_username" | |
fi | |
echo "git profile has been switched to use the profile - "$profileToUse"." | |
git config -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment