Loading...
 

Git and SSH Key Pairs

Multiple Git Accounts

Google Cloud Source Repositories, AWS CodeCommit, BitBucket, GitHub, etc.

~/.ssh/config
# Michael Alber
# GitHub
Host github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/michaelalber/github_id_rsa

# Acme
# AWS CodeCommit
Host acme.git-codecommit.us-west-1.amazonaws.com
    HostName git-codecommit.us-west-1.amazonaws.com
    User XPXAX2XX3PXCXHX2XBXQ
    IdentityFile ~/.ssh/acme/awscodecommit_id_rsa

# Project X
# AWS CodeCommit
Host projx.git-codecommit.us-west-1.amazonaws.com
    HostName git-codecommit.us-west-1.amazonaws.com
    User AXKXJX5XXS4XIXSMXMXA
    IdentityFile ~/.ssh/projectx/awscodecommit_id_rsa

# Project Y
# BitBucket
Host bitbucket.org
    HostName bitbucket.org
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/projecty/bitbucket_id_rsa

# ProjectCool
# BitBucket
Host pc.bitbucket.org
    HostName bitbucket.org
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/pc/bitbucket_id_rsa

Cloning Repos - Using the Above SSH Keys

# Michael Alber - GitHub
git clone git@github.com:michaelalber/my-repo.git

# Acme - AWS CodeCommit
git clone ssh://acme.git-codecommit.us-west-1.amazonaws.com/v1/repos/my-repo

# Project Y - BitBucket
git clone git@bitbucket.org:projecty/my-repo.git

# Project Cool - BitBucket
git clone git@pc.bitbucket.org:projectcool/my-repo.git


Last edited by MichaelAlber .
Page last modified on Wednesday February 12, 2020 15:09:56 UTC.