Files
code-snippets/docs/git/ssh-config.md
Liam Pietralla bfc110e1c1
All checks were successful
Build, Test & Publish / Build (push) Successful in 1m18s
Build, Test & Publish / Build and Publish Container Image (push) Successful in 2m47s
Build, Test & Publish / Deploy to Infrastructure (push) Successful in 37s
update git section
2026-03-03 07:17:52 +11:00

733 B

Git SSH Config

When using SSH to connect to a remote repository, you can configure your SSH client to use a specific key for a specific host. This is useful when you have multiple keys and want to use a specific key for a specific host.

Sample configuration is below

# ~/.ssh/config
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/my-github-key
  PreferredAuthentications publickey

Generate SSH Key

Use the following to generate a new SSH key:

ssh-keygen -t ed25519 -C "<email>"

Configure Git User

You can configure your Git user name and email using the following commands:

git config --global user.name "Your Name"
git config --global user.email "<email>"