Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.5 KB

github.md

File metadata and controls

38 lines (33 loc) · 1.5 KB

GitHub Cheatsheet

Adding Multiple ssh keys (on Mac)

  1. Create new key ssh-keygen rsa -C "email address for account"
  2. Don't overwrite your keys. Give each key its own name. For example id_rsa_Account1 and id_rsa_Account2. Or just give your primary account id_rsa and name the other accounts accordingly.
  3. Attach the new key.
    1. Open the id_rsa_AccountName.pub file. Copy the string from that file.
    2. Login to GitHub
    3. Click Settings (top right)
    4. Click the SSH keys link (left hand nav)
    5. Click the "Add SSH key" button
    6. Provide title like "home computer"
    7. Paste string into "key" field
  4. Create a config file
    1. touch ~/.ssh/config
    2. subl ~/.ssh/config
    3. Create 2 entries, the first should entry is your default github account and the second should be your secondary account. The config file should look something like this:
#Default Account
Host github.com
  HostName github.com
  User [username1]
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
   
#Secondary Account
Host github-SECONDARY
  HostName github.com
  User [username2]
  IdentityFile ~/.ssh/id_rsa_Account2
  IdentitiesOnly yes

Make sure you add the IdentitiesOnly yes. This is neccessary to make sure that you don't log into a GitHub account and get "stuck" with it.

To add remote repository using that secondary account

git remote add origin git@github-SECONDARY:account2/repoName.github.io.git