This is a simple bash script for people that uses more than 1 github account on 1 machine to pick which account to use when a git repository is initiated.
This script uses the git config --local command to set the username and email for the current repository.
How to use:
- Create the script file. I created a new directory on home called Scripts to store my scripts.
- Copy and paste
giniscript to the new file. - Fill in the appropriate usernames and emails, and feel free to add more
elifstatements if you have more accounts. - Allow users to execute the
giniscript by changing the permission withchmod +x gini - Open a file where you store the aliases for your shell, e.g.
.bashrc,bash_aliases,.zshrc, etc. - Set an alias for
ginion the file that you've opened withalias gini=/path/to/script.