Skip to content

Instantly share code, notes, and snippets.

@Tholkappiar
Last active May 22, 2025 19:44
Show Gist options
  • Save Tholkappiar/7065da630843eddc48c66d8966a80103 to your computer and use it in GitHub Desktop.
Save Tholkappiar/7065da630843eddc48c66d8966a80103 to your computer and use it in GitHub Desktop.
gitconfig
### create ssh keys on names - pers and work and add to the github
config in .ssh dir
Host pers
HostName github.com
User git
IdentityFile ~/.ssh/pers ### private key
IdentitiesOnly yes
Host work
HostName github.com
User git
IdentityFile ~/.ssh/work ### private key
IdentitiesOnly yes
.gitconfig
[includeIf "gitdir:~/Developer/work/"]
path = ./.workconfig
[includeIf "gitdir:~/Developer/pers/"]
path = ./.persconfig
[user]
email = email.com
name = name
.persconfig
[user]
name = pers_name
email = pers_mail.com
[core]
sshCommand = "ssh -i ~/.ssh/pers" ### private key
.workconfig
[user]
name = work_name
email = work_email.com
[core]
sshCommand = "ssh -i ~/.ssh/work" ### private key
### Test
ssh -T git@pers
ssh -T git@work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment