Skip to content

Instantly share code, notes, and snippets.

@hamidne
Created September 16, 2019 02:27
Show Gist options
  • Save hamidne/5091674510061cce84527df11f2055cb to your computer and use it in GitHub Desktop.
Save hamidne/5091674510061cce84527df11f2055cb to your computer and use it in GitHub Desktop.

Generate SSH Key

ssh-keygen -t rsa -C "your.email@example.com" -b 4096

Copy SSH Key and Use them

macOS:

pbcopy < ~/.ssh/id_rsa.pub

GNU/Linux (requires the xclip package):

xclip -sel clip < ~/.ssh/id_rsa.pub

Windows Command Line:

type %userprofile%\.ssh\id_rsa.pub | clip

Git Bash on Windows / Windows PowerShell:

cat ~/.ssh/id_rsa.pub | clip

Fixed Bug With Custom Port Source

To test if SSH over the HTTPS port is possible, run this SSH command:

$ ssh -T -p 443 git@ssh.github.com
> Hi username! You've successfully authenticated, but GitHub does not
> provide shell access.

If that worked, great! If not, you may need to follow our troubleshooting guide.

Enabling SSH connections over HTTPS

If you are able to SSH into git@ssh.github.com over port 443, you can override your SSH settings to force any connection to GitHub to run though that server and port.

To set this in your ssh config, edit the file at ~/.ssh/config, and add this section:

Host github.com
  Hostname ssh.github.com
  Port 443

You can test that this works by connecting once more to GitHub:

$ ssh -T git@github.com
> Hi username! You've successfully authenticated, but GitHub does not
> provide shell access.

Login Without Password

copy your ~/.ssh/id_rsa.pub and store to ~/.ssh/authorized_keys

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