Created
December 3, 2013 22:58
-
-
Save aghyad/7779162 to your computer and use it in GitHub Desktop.
how to work with more than one user and more than one key
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
To be able to utilize more than one key in your github environment on one computer, and assuming we have the 2 following keys: | |
~/.ssh/id_rsa_personal_key | |
~/.ssh/id_rsa_company_key | |
Create the file ~/.ssh/config with the follwoing content: | |
### Default (Personal) GitHub | |
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa_personal_key | |
### Company GitHub | |
Host company-github | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa_company_key | |
Make sure all the keys added: | |
$ ssh-add -l ### this should list the keys added | |
$ ssh-add /path/to/your/key ### to add a key | |
Also, to be able to track your user contributions separately, make sure you are working with the correct github user: | |
$ git config user.email ### to list the email of the current user | |
$ git config --global user.name "USERNAME-HERE" && git config --global user.email USER-EMAIL-HERE ### to update the current working username & email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment