Multiple Git Accounts on single machine

Type
Gist
Tags
Published
Author
 
Head back over to the SSH config file at ~/.ssh and amend accordingly to:
#user1 account Host github.com-user1 HostName github.com User git IdentityFile ~/.ssh/github-user1 IdentitiesOnly yes #user2 account Host github.com-user2 HostName github.com User git IdentityFile ~/.ssh/github-user2 IdentitiesOnly yes
Replace user1 or user2 with your GitHub usernames/identification-handlers
 
Go ahead to git clone your respective repository
git clone [email protected]:user1/your-repo-name.git your-repo-name_user1
 
Configure your git identity:
  • Open up local git config using git config --local -e and add:
[user] name = user1 email = [email protected]
 
More detailed reference