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
If you use an SSH URL (git@github.com:username/projectname.git
) rather than an HTTPS URL, you can temporarily specify a different SSH key using the $GIT_SSH_COMMAND
environment variable:
$ GIT_SSH_COMMAND="ssh -i different_private_key" git push
As far as I can tell, with SSH URLs, GitHub doesn't care about user names, only about keys: if a user account has access to a repository, and that account has an SSH key (see the SSH keys page in the account settings), then if you use that SSH key to push to that repository, the push will be treated as coming from that user.