Created
July 8, 2020 05:26
-
-
Save perfmind/fbf2edbc09798d94a079a530105dd854 to your computer and use it in GitHub Desktop.
Change SSH Key, it's convenient when you have multiple git repository account.
This file contains hidden or 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
| work sulton@work.com | |
| contribution sulton@contribution.com | |
| personal shcode@personal.com |
This file contains hidden or 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
| # Create folder ~/.ssh_profile and put yout ssh key based on profile | |
| # If you have 3 different account you must create 3 folder, for example: personal, work, contribution | |
| # Create file .ssh_email and fill with your associated email for your accounts | |
| # | |
| csk() { | |
| if `ls -1 ~/.ssh_profile | grep -q $1`; then | |
| rm ~/.ssh | |
| ln -s ~/.ssh_profile/$1 ~/.ssh | |
| ssh_email=`cat ~/.ssh_profile/.ssh_email | grep "$1\t" | sed "s/$1 //"` | |
| git config --global user.email $ssh_email | |
| else | |
| echo "ssh profile $1 not found." | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment