3 ms·
I think you can achieve this with an SSH config like Host github-personal HostName github.com IdentityFile ~/.ssh/id_rsa_personal Host github-work H
by batuhanicoz 5y ago
I think you can achieve this with an SSH config like
Host github-personal
HostName github.com
IdentityFile ~/.ssh/id_rsa_personal
Host github-work
HostName github.com
IdentityFile ~/.ssh/id_rsa_work
Then you can use `github-work` or `github-personal` in the remote URL like `git clone git@github-work:mywork/somerepo.git`.
edit: I realized after reading the other comments that I got the problem wrong! This would push the commits from the correct GitHub account but the commits would still have the e-mail from git's config and GitHub would link the account in the committer e-mail.
- judge2020 5y ago> This would push the commits from the correct GitHub account but the commits would still have the e-mail from git's config and GitHub would link the account in the committer e-mail. That seems like a situation where you'd `git config user.email` within your work repo(s) so that it's set locally, not globally. I also think GitHub primarily supports and envisions people using one GH account for work and personal projects.