Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.01 KB

multi_github_creds.README.md

File metadata and controls

37 lines (30 loc) · 1.01 KB

github doesn't allow you to use the same ssh key across accounts, hence each Host entry has a separate IdentifyFile. the name of the Host entry will be used to specify which creds to use when cloning. I think

~/.ssh/config

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/janus_ed25519
    AddKeysToAgent yes

# personal
Host github.com-joshbadger
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519
    AddKeysToAgent yes

add these keys to your ssh agent:

ssh-add --apple-use-keychain ~/.ssh/janus_ed25519 ~/.ssh/id_ed25519

to clone repos, use the Host name defined above in your ssh config (not to be confused with the HostName )

git clone [email protected]:joshbadger/dotfiles.git

git clone [email protected]:[email protected]:janushealthinc/janus-data-science.git

if repos already exist, change the origin to use the new Host:

# from the repo dir:
cd ~/src/dotfiles
git remote set-url origin [email protected]:joshbadger/dotfiles.git