A friend and myself are sharing my computer. I\'ve made pushes to GitHub using the git bash shell on Windows 7. Now we\'re in a different project on that computer and I need
I have been using one machine to push code to two different GitHub accounts with different username. Assuming you already set up one account and want to add a new one:
ssh-keygen -t rsa -C "myaddress@example.com"id_rsa. Give it a different name, e.g. id_rsa_anotherSettings -> SSH and GPG keys -> New SSH key -> Give a label and paste the key -> Add SSH key
ssh-add ~/.ssh/id_rsa_anothertouch ~/.ssh/config and edit the file by providing configurations to your accounts:#first account
Host github.com-first
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
#another account
Host github.com-another
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_another
Now you should be able to push from different accounts depending on what key you add to the ssh agent, i.e. to use your first account, do
ssh-add ~/.ssh/id_rsa.
You might also want to change your user email:
git config --global user.email "myaddress@example.com"
or clean out ssh keys in case of permission error when pusing code to one of the accounts:
ssh-add -D