Skip to content

Instantly share code, notes, and snippets.

@elmodos
Created December 17, 2021 22:05
Show Gist options
  • Save elmodos/94751a2c0d138df599e014ada534f039 to your computer and use it in GitHub Desktop.
Save elmodos/94751a2c0d138df599e014ada534f039 to your computer and use it in GitHub Desktop.
GitHub with multiple repos and usernames on single machine
~/.gitconfig
[user]
name = Personal Name
email = personal@email.com
[includeif "gitdir:~/Projects/Company/"]
path = Projects/Company/gitconfig-company
~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_personal
Host github-company
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_company
~/Projects/Company/gitconfig-company
[user]
name = Business Name
email = business.name@company.com
@elmodos
Copy link
Author

elmodos commented Dec 17, 2021

then instead of

git clone git@github.com:aaa/bbb.git

use

git clone github-company:aaar/bbb.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment