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
gini
script to the new file. - Fill in the appropriate usernames and emails, and feel free to add more
elif
statements if you have more accounts. - Allow users to execute the
gini
script 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
gini
on the file that you've opened withalias gini=/path/to/script
. - Run
source .zshrc
orsource .bashrc
to reload your shell settings. - Move to your project directory and run
gini
to test it out.
Sorry I was too lazy to come up with a good name, so I'll just call this gini
for now.