I keep messing this up, so documenting what I currently remember here. If future Irene arrived here because of a bad commit, this is how you undo the latest commit: git reset HEAD~
(SO post)
To start, I set up my work and personal accounts with separate SSH keys (id_rsa files, etc) using this guide.
I'm never clear on what's going on behind the scenes in the RStudio git pane, so I tend to use the terminal when using my secondary (personal) account. Each time I open a new personal project, I need the following steps.
- When cloning the repo, add "personal" to the URL (this is how I have it set up):
git@personal.github.com:isteves/my_repo.git
- After cloning and creating a new RProject, run
ssh-add ~/.ssh/id_rsa_personal
in the terminal to switch to the personal account. Rungit config user.email
orgit config --list
to check/change credentials for good measure - The git pane can be used for adding files, but I use the terminal for committing & pushing (have yet to confirm if this makes a difference).