Follow steps 1 and 2 from this guide (copied below)
You'll either need to move the rsa keys into the folder structure defined in users.py
, or modify users.py
to fit your desired folder structure
Then simply run python git_set_user.py profile
to set your credentials in the current git repo, and python git_clone_as_user.py profile git_ssh_url
to clone a git repo with your credentials.
(NOTE: You will have to use the SSH version of remote urls, for both pushing / pulling and cloning)
We need to generate a unique SSH key for our second GitHub account.
ssh-keygen -t rsa -C "your-email-address"
Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY
. In my case, I've saved the file to ~/.ssh/id_rsa_work
.
Next, login to your second GitHub account, browse to "Account Overview" and attach the new key, within the "SSH Public Keys" section. To retrieve the value of the key that you just created, return to the Terminal and type: vim ~/.ssh/id_rsa_COMPANY.pub.
Copy the entire string that is displayed, and paste this into the GitHub textarea. Feel free to give it any title you wish.
Next, because we saved our key with a unique name, we need to tell SSH about it. Within the Terminal, type: ssh-add ~/.ssh/id_rsa_COMPANY
. If successful, you'll see a response of Identity Added.