Skip to content

Instantly share code, notes, and snippets.

@tojibon
Created August 30, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tojibon/cada5c83b660bbeb7dd79f044e2a957c to your computer and use it in GitHub Desktop.
Save tojibon/cada5c83b660bbeb7dd79f044e2a957c to your computer and use it in GitHub Desktop.
Multi Account Git
ssh-keygen -t rsa
ssh-add ~/.ssh/id_rsa

ssh-keygen -t rsa -C "companyName" -f "companyName"
ssh-add ~/.ssh/companyName
nano ~/.ssh/config
Host bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/id_rsa
Host companyname.bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/companyName
Host github.com
  HostName github.com
  IdentityFile ~/.ssh/id_rsa
Host companyname.github.com
  HostName github.com
  IdentityFile ~/.ssh/companyName
git clone git@bitbucket.org:yourPersonalAccount/pet-project.git
git clone git@bitbucket.org:companyName/company-project.git
git clone git@companyname.bitbucket.org:companyName/company-project.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment