Prepare the directory if needed
macOS / Linux (POSIX shell)
mkdir -p ~/.ssh && chmod 700 ~/.sshPowerShell 7.3+
New-Item -ItemType Directory -Force "$HOME/.ssh" | Out-NullGenerate a key pair
macOS / Linux (POSIX shell)
ssh-keygen \
-t ed25519 \
-N "" \
-C "ci_github 2026-10-29" \
-f ~/.ssh/id_ed25519_ci_githubPowerShell 7.3+
ssh-keygen `
-t ed25519 `
-N "" `
-C "ci_github 2026-10-29" `
-f "$HOME/.ssh/id_ed25519_ci_github"Choose a fresh output filename and customize the comment and key name. If the file already exists, decline the overwrite prompt unless you intend to replace that key. Do not suppress the prompt or force an overwrite.
Understand the options
-t ed25519selects the Ed25519 key type.-N ""sets an empty passphrase. The automation example leaves the private key without passphrase encryption; use a passphrase for a personal key.-Csets a comment stored in plain text in the public key. Use<source>_<destination> <creation date>so the destination can trace and rotate the key; never include secrets.-fsets the output filename. Name keysid_<type>_<source>_<destination>[_purpose], for example~/.ssh/id_ed25519_ci_github,~/.ssh/id_ed25519_home-server_github, or~/.ssh/id_ed25519_dev-laptop_vps_backup.
Share the public key
The extensionless file is the private key. Keep it protected on the source machine or in its CI secret store. The .pub file is the public key; give that file to the destination service. Never share or display private-key contents.
macOS / Linux (POSIX shell)
cat ~/.ssh/id_ed25519_ci_github.pubPowerShell 7.3+
Get-Content "$HOME/.ssh/id_ed25519_ci_github.pub"Install the public key on a server
For a server you log in to with SSH, append the public key to its ~/.ssh/authorized_keys. Replace user@server.example.com with your account and host; the command asks for your existing password once. For GitHub or another service, paste the .pub contents into its key settings instead.
macOS / Linux (POSIX shell)
ssh-copy-id \
-i ~/.ssh/id_ed25519_ci_github.pub \
user@server.example.comPowerShell 7.3+
Get-Content "$HOME/.ssh/id_ed25519_ci_github.pub" |
ssh user@server.example.com `
"umask 077; mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"References
- OpenBSD ssh-keygen manual documents key types, options, and private/public output files.