Skip to content

Instantly share code, notes, and snippets.

@lonmiller
Forked from justinpawela/config
Last active November 2, 2023 08:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonmiller/6f6c00400bf627642a3696dc575d2e6b to your computer and use it in GitHub Desktop.
Save lonmiller/6f6c00400bf627642a3696dc575d2e6b to your computer and use it in GitHub Desktop.
AWS CodeCommit Multiple Account Config
# This file is: ~/.ssh/config
# You may have other (non-CodeCommit) SSH credentials stored in this
# config file – in addition to the CodeCommit settings shown below.
# NOTE: Make sure to run [ chmod 600 ~/.ssh/config ] after creating this file!
# also, to force git to use this file for all git operations:
# git config --global core.sshCommand "ssh -F path-to-.ssh/config"
# Credentials for Account1
Host awscc-account1 # 'awscc-account1' is a name you pick
Hostname git-codecommit.us-east-1.amazonaws.com # This points to CodeCommit in the 'US East' region
User A1EXAMPLE01234567891 # UserID as provided by IAM Security Credentials (SSH)
IdentityFile ~/.ssh/account1-awsCC-rsa # Path to corresponding key file
# Credentials for Account2
Host awscc-account2
Hostname git-codecommit.us-east-1.amazonaws.com
User A2EXAMPLE01234567892
IdentityFile ~/.ssh/account2-awsCC-rsa
# with changes to OpenSSH deprecating rsa support, need to add overrides for CodeCommit until they update their certificate key types
# add following due to openssh deprecating ssh-rsa key types
HostkeyAlgorithms +ssh-rsa
# From https://github.com/git-for-windows/git/issues/3468
# PubkeyAcceptedAlgorithms +ssh-rsa - does not work for versions of openssh before 8.5
# for pre-8.5 versions of openssh use
PubkeyAcceptedKeyTypes +ssh-rsa
# Credentials for Account3
Host awscc-account3
Hostname git-codecommit.us-east-1.amazonaws.com
User A3EXAMPLE01234567893
IdentityFile ~/.ssh/account3-awsCC-rsa
@lonmiller
Copy link
Author

Updated for issues with CodeCommit caused by OpenSSH deprecation of ssa-rsa support.

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