What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

For most current Git and server connections, generate an Ed25519 pair with ssh-keygen -t ed25519 -C "your_email@example.com". Accept the suggested filename, protect the private key with a strong passphrase, load it into ssh-agent, and upload only the matching .pub file to GitHub or GitLab. Windows 10 and later, macOS, and GNU/Linux include OpenSSH; use PowerShell or Git Bash on Windows and Terminal on macOS or Linux.

This guide covers existing-key checks, filenames, permissions, agents, host identities, hardware-backed keys, server-side installation, Git hosting, diagnostics, recovery, replacement, and safe termination of a key.

At a glance
Option What you need Best for
Ed25519 software key OpenSSH and a passphrase Most Git hosting and modern SSH clients
RSA 4096 OpenSSH with RSA support Legacy clients that do not support Ed25519
Ed25519-SK or ECDSA-SK Compatible FIDO2 security key and user touch Hardware-backed authentication
Host-specific Ed25519 filename Separate file and SSH configuration entry Multiple Git accounts or servers

What files make up an SSH key pair?

An SSH pair has a private key and a public key. The private key normally has no extension (for example, id_ed25519); the public half is the same name ending in .pub (for example, id_ed25519.pub). The public key can be copied to a service or server. The private key must remain on your computer, protected by its passphrase and file permissions. GitLab explicitly notes that it cannot access your private key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before creating anything, inventory the .ssh directory. On macOS and Linux, run:

Popular on Amazon
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
ls -la ~/.ssh

In PowerShell, use:

Get-ChildItem $HOME\.ssh -Force

Git Bash accepts the Unix form ls -la ~/.ssh. Look for pairs such as id_ed25519/id_ed25519.pub, id_rsa/id_rsa.pub, or names you created for a host. Do not overwrite a pair that is still used. If the default filename already exists, provide a distinct path when ssh-keygen asks where to save the new key.

How do I generate an Ed25519 key on Windows, macOS, or Linux?

OpenSSH is documented as pre-installed on Windows 10, macOS, and GNU/Linux. GitHub’s current procedure uses the following command and describes the email as a label, not as a secret. See the GitHub key-generation guide for platform screenshots and current interface labels.

ssh-keygen -t ed25519 -C "your_email@example.com"
  1. Start Terminal on macOS or Linux, or PowerShell/Git Bash on Windows.
  2. Run the command. At the file prompt, press Enter for the suggested default, usually ~/.ssh/id_ed25519. If that path is occupied, enter a host-specific name such as ~/.ssh/id_ed25519_github_work.
  3. Enter a long, unique passphrase, then enter it again. A passphrase encrypts the private key if someone copies the file.
  4. Confirm that OpenSSH reports the private and public filenames. It also prints a fingerprint and an optional random-art image for identification.

The default locations look like /Users/YOU/.ssh on macOS, /home/YOU/.ssh on Linux, and /c/Users/YOU/.ssh in Git Bash. PowerShell may display the equivalent Windows path under your user profile. The filename is not cosmetic: it is how you distinguish work, personal, and server identities.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which SSH algorithm should I choose: Ed25519, RSA, ECDSA, or DSA?

Choose Ed25519 unless a documented compatibility requirement says otherwise. It is the default in current GitHub and GitLab workflows and produces a compact modern key. For a legacy client that lacks Ed25519 support, use RSA with 4096 bits:

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

ECDSA is another elliptic-curve family supported by many OpenSSH versions, but it is not the recommended first choice when Ed25519 is available. A security-key-backed ECDSA form is discussed below. DSA is an obsolete SSH algorithm and is disabled or unsupported by modern OpenSSH builds; do not create a DSA key for a new deployment. If an old appliance demands DSA, treat that as a replacement project rather than weakening a current workstation.

Keep separate filenames and comments for different hosts or accounts. The comment supplied with -C helps you identify a key in a settings page; it does not grant access and is not confidential.

How should I protect the private key?

Never upload, email, paste, or commit the private file. Copy only the complete one-line contents of the .pub file. On a multi-user Unix system, the home and .ssh directories should be owned by your account, and the private key should not be readable by other users. Typical tightening commands are:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Also popular on Amazon
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub

Use the equivalent access controls on Windows and confirm that inherited permissions do not grant broad access. Do not change ownership to an administrator account merely to make a command work; the account running SSH should own its key. If your operating system reports a permissions error, inspect ownership and access rules first.

A passphrase protects a stolen file, while permissions protect against other local accounts. Use both. Store an emergency backup of the encrypted private key only in a location you control; a backup without its passphrase is not useful, and a passphrase written beside the backup defeats the protection.

How do I load the correct private key into ssh-agent?

The agent and environment determine which identities SSH can offer without asking for a passphrase each time. Start or enable the operating system’s OpenSSH agent, then add the exact private filename you intend to use:

ssh-add ~/.ssh/id_ed25519
ssh-add -l

The second command inventories fingerprints currently held by the agent. On macOS, GitHub documents this keychain-aware form:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

On Windows, use the path syntax accepted by your OpenSSH installation, such as ssh-add $HOME\.ssh\id_ed25519 in PowerShell or ssh-add ~/.ssh/id_ed25519 in Git Bash. If ssh-add -l says there are no identities, add the key again or start the agent service. If several keys are loaded, SSH may offer the wrong identity first; a host configuration entry can select the right one.

For a named identity, create or edit ~/.ssh/config:

Host github-work
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_github_work
    IdentitiesOnly yes

Then use a remote such as git@github-work:OWNER/REPOSITORY.git. The SSH username for GitHub and GitLab operations is normally git; the repository owner and hostname are supplied by the service’s clone URL. For a regular server, the username is your server account and the hostname is its DNS name or address.

Also popular on Amazon
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

How do I identify the matching public key?

The public key must match the private key you offer. Display it without altering the line:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cat ~/.ssh/id_ed25519.pub

PowerShell:

Get-Content $HOME\.ssh\id_ed25519.pub

Git Bash:

cat ~/.ssh/id_ed25519.pub

Copy from the beginning of the key type (for example, ssh-ed25519) through the final comment, with no inserted line breaks. To verify that a public file corresponds to a private key, derive a public key from the private key and compare the result:

ssh-keygen -y -f ~/.ssh/id_ed25519

That output should match the key material in id_ed25519.pub. You can also compare fingerprints:

ssh-keygen -lf ~/.ssh/id_ed25519.pub

Read verbose SSH output when authentication fails:

ssh -vT git@github.com
ssh -vvv user@hostname

Look for the identity files SSH discovers, keys it offers, and the server’s acceptance or rejection. Verbose output can reveal a wrong filename, wrong username, wrong hostname, an agent with no identities, or a public key that was copied incompletely. Do not publish private-key contents or passphrases from diagnostic logs.

How do I add the public key to GitHub?

After generating and identifying the key, copy the entire .pub line. In GitHub, open your profile menu, choose Settings, then SSH and GPG keys, select New SSH key (or Add SSH key), enter a recognizable title such as “Work Laptop,” paste the public key, and save. The private key remains local while Git operations use the SSH remote.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test the account connection with:

ssh -T git@github.com

If your repository remote still uses HTTPS, change it to the SSH URL shown by the repository’s Code menu, or clone again using that URL. For multiple GitHub accounts, use separate filenames and Host aliases so the correct identity is offered.

How do I add the public key to GitLab?

Copy the complete contents of the public file, then open GitLab and go to Edit profile → Access → SSH keys. Paste the key, enter a title such as “Work Laptop,” choose the intended usage when GitLab presents that option, and add the key. The current GitLab SSH documentation explains the same Ed25519 workflow and key-management fields.

Also popular on Amazon
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

GitLab checks submitted keys against known compromised keys. If it rejects a key as compromised, generate a replacement pair with a new filename and register the new public key; that restriction cannot be configured away. Test with ssh -T git@gitlab.com and ensure the remote uses the GitLab SSH hostname rather than an HTTPS URL.

Can I use a hardware-backed SSH key?

Yes. With a compatible security key connected, generate a resident-backed or hardware-protected credential using:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh-keygen -t ed25519-sk -C "your_email@example.com"

Touch the security key when OpenSSH asks. If the command reports an unsupported feature or invalid format, use the documented ECDSA security-key fallback:

ssh-keygen -t ecdsa-sk -C "your_email@example.com"

This route adds a physical-possession requirement and model-compatibility check. A YubiKey 5C NFC is a FIDO2 security key option for readers who want hardware-backed authentication; verify compatibility with your OpenSSH version and device before buying. Keep the generated public file available for registration, and protect any local credential handle or private companion file just as you would a software key.

How do I install a key directly on an SSH server?

For a server you administer, provisioning means placing the public key in the target account’s server-side location, normally ~/.ssh/authorized_keys. The line must remain intact, and the directory and file need restrictive ownership and permissions. The account name and hostname matter: test with ssh username@hostname, not with a different account or alias.

If you have password access, ssh-copy-id -i ~/.ssh/id_ed25519.pub username@hostname can append the public key on systems that provide that utility. Otherwise, use the server’s approved console or management process to add the line. Never place the private key on the server merely because the public key was provisioned there.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After installation, test a new session before closing your existing one. This confirmation step prevents a permissions or username mistake from terminating your only access path. Once the key works, review server logs and SSH configuration according to your platform’s policy.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What should I do when authentication fails?

  1. Confirm the environment. Check which ssh, ssh-keygen, and ssh-add executables are running, especially when Windows has both Git Bash and OpenSSH installations.
  2. Check inventory. Run ssh-add -l and verify the fingerprint of the intended identity. Add the correct private filename if it is absent.
  3. Check the remote. Confirm the username, hostname, port, and SSH-form remote URL. A valid key for one host will not authenticate to another host unless that service has the matching public key.
  4. Check the public line. Re-copy the entire .pub file as one line and compare its fingerprint with the local file.
  5. Read verbose output. Run ssh -vvv user@hostname and inspect which identities are offered and why the server refuses them.
  6. Check permissions and ownership. On the server, verify the account owns ~/.ssh and authorized_keys and that the SSH daemon can read them.
  7. Check algorithm support. If Ed25519 is unknown, update the OpenSSH client or create the RSA 4096 compatibility key.

Do not delete a working key until a replacement has been tested from a fresh terminal and, for a server, a second session. Keep a recovery path such as an existing administrator session or console access.

Also popular on Amazon
FIDO2 U2F Security Key Passkey Two-Factor Authentication (2FA) USB Key PIN+Touch (Non-Biometric) USB-A Type TrustKey T110
  • Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
  • Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
  • Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
  • Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
  • For the driver download and user guide, please visit TrustKey Solutions Home support page.

When should I replace or terminate an SSH key?

Replace a key when the private file may have been copied, its passphrase is exposed, the device is lost, an administrator leaves, a service reports compromise, or an account boundary changes. Generate a new pair, add the new public key everywhere it is needed, test it, and then remove the old public key from GitHub, GitLab, server authorized_keys, and agent inventories. A compromised key should not be reused with a new comment.

Termination means revoking access, not merely deleting the local file. Remove the key from hosted-account settings, server-side locations, deployment systems, and automation secrets; unload it with ssh-add -d ~/.ssh/id_ed25519 where supported; and securely delete local copies according to your operating system’s policy. Review your key inventory periodically so retired filenames, stale agent entries, and forgotten host aliases do not remain active.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I keep several identities organized?

Use a descriptive filename, comment, and Host alias for each account. For example, keep id_ed25519_github_personal and id_ed25519_github_work separate, then map each alias with IdentityFile and IdentitiesOnly yes. This prevents SSH from offering the wrong identity and makes a later replacement or termination precise.

Record where each public key is provisioned, which username and hostname it serves, when it was created, and who is responsible for revoking it. That small review inventory is especially valuable for build agents and shared administration, where an unnoticed key can outlive the person or system that created it.

Bottom line: Generate Ed25519 by default, protect and inventory the private key, offer the intended identity through the agent or SSH configuration, and register only the matching public key. Use RSA 4096 for legacy compatibility and a security-key variant when physical hardware protection is worth the added requirement.

Frequently Asked Questions

Where is my SSH public key on Windows?

In PowerShell it is normally under $HOME\.ssh\id_ed25519.pub; Git Bash presents the same file as ~/.ssh/id_ed25519.pub. Use Get-Content or cat to display it, and make sure you select the file matching the private key you intend to offer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I reuse one SSH key for GitHub and GitLab?

Technically, the same public key can be registered with both services, but separate host-specific pairs make access review and revocation clearer. Distinct filenames and SSH configuration aliases also prevent the wrong account identity from being offered.

What happens if I lose the passphrase?

The encrypted private key cannot normally be recovered by resetting the passphrase. Generate a new pair, add its public key to every required service or server, test it, and revoke the old key if it might still be usable.

Why does GitLab reject an otherwise valid public key?

GitLab checks submitted keys against known compromised keys, so a key can be refused even when its format is correct. Create a fresh pair with a new filename and register that public key instead of trying to bypass the restriction.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply. Prices as of November 19, 2026 1:08 pm GMT.