Reputation: 555
I have two github accounts which i am using on same computer. I have been successful in connecting and commiting the changes to both of my github accounts from same machine.
The issue I am facing is I am not sure the commits that are being done - how to automatically set different usernames email value to different Host names or github accounts
My new config file looks like -
#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-COMPANY
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_COMPANY
If my try to commit to any public repo of my company it takes my personal github name configuration which I initially set up in global config file..
Any help would be appreciated.
Thanks, Kaushik
Upvotes: 1
Views: 827
Reputation: 1323175
how to automatically set different usernames email value to different Host names or github accounts
This isn't related to your ssh private key IdentityFile that you would use to authenticate yourself to GitHub when pushing a repo.
Commits are done independently of any https or (in your case) ssh credentials.
Their committer / author names and emails depends on the global or local config user.name and user.email.
In each of your repo, type
git config user.name theRightName
git config user.email theRight@email
And you will have the correct values for those repos.
Upvotes: 1