Skip to content

Instantly share code, notes, and snippets.

@lemissel
Created July 3, 2021 02:48
Show Gist options
  • Save lemissel/7542ae5ab3479788b0ea77d5e02ac37f to your computer and use it in GitHub Desktop.
Save lemissel/7542ae5ab3479788b0ea77d5e02ac37f to your computer and use it in GitHub Desktop.
Multiple Github accounts on the same computer
  1. Generate as SSH-key ssh-keygen -t rsa -C "john@doe.com", folow the prompts and decide a name, e.g. id_rsa_doe_company.
  2. Copy the SSH public-key to GitHub from ~/.ssh/id_rsa_doe_company.pub and tell ssh about the key: ssh-add ~/.ssh/id_rsa_doe_company.pub
  3. Create a fongi file in ~/.ssh with the follownig contents:
HOST github-doe-company
  HostName github.com
  User git
  IdentityFIle ~/.ssh/ir_rsa_doe_company
  1. Add yout remote git remote add origin git@github-doe-company:username/repo.git or git remote set-url origin git@git-doe-company:username/repo.git

Source: http://stackoverflow.com/questions/3860112/multiple-github-accounts-on-the-same-computer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment