Generate an SSH key
Creates a modern, secure key pair in ~/.ssh. Press Enter to accept the default location.
ssh-keygen -t ed25519 -C ""Generate SSH keys, connect to GitHub and servers, copy files securely and forward ports through an SSH tunnel.
9 commands
Creates a modern, secure key pair in ~/.ssh. Press Enter to accept the default location.
ssh-keygen -t ed25519 -C ""Puts the public key on the clipboard to paste into GitHub, GitLab or a server.
pbcopy < ~/.ssh/id_ed25519.pubPuts the public key on the clipboard.
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-ClipboardStores the passphrase in Keychain so you’re not asked every time.
ssh-add --apple-use-keychain ~/.ssh/id_ed25519Confirms GitHub accepts your key.
ssh -T git@github.comLets you log in without a password from now on.
ssh-copy-id @Copies a file over SSH. Add -r for folders.
scp @:Open http://localhost:8080 to reach the server’s port 80 through an encrypted tunnel.
ssh -L :localhost: @SSH refuses private keys other users can read.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519Every command copies as plain, clean text: no curly quotes, no long dashes, no invisible characters.