Skip to content

Instantly share code, notes, and snippets.

@storbukas
Last active January 29, 2021 12:29
SSH config for public key authentication with GitHub
# File: .ssh/config
# SSH config for public key authentication with GitHub (SSH or HTTPS)
# Alternative 1: Regular (SSH)
# -----------------------------------------------------
# You can check if your network allows you to use port 22
# by testing if you can access http://portquiz.net:22
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /Users/larserik/.ssh/id_rsa
# Alternative 2: Wrapping SSH in HTTPS
# -----------------------------------------------------
# This option is suitable when your network has blocked
# network requests over port 22.
Host github.com
User git
Hostname ssh.github.com
Port 443
PreferredAuthentications publickey
IdentityFile /Users/larserik/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment