I have two GitHub accounts, one is for my work and the other is for my personal use. I want to keep these two separate when I'm doing commits.
Currently, I simply change my GitHub credentials when I can in different repositories on my local system based on whether is it a work/personal repo. Once I am in that repo, I write the following commands to change to that account:
git config --global user.name "myusername"
git config --global user.email [myemail]
Then I handle my git commands and it seems to work fine. I still have a few questions as I feel it's not the correct way to handle things.
1) If I change my git user/email to my personal account in my work repo and made a commit, will that commit be successful and go through to GitHub? It seems like it does which I don't understand. Would GitHub not check to see if that account has permission to make a commit to that repo?
2) Can you recommend a better way to handle swapping between my work/personal accounts to keep those two completely separate?
Thanks!