How to fix ssh-add: No identities found in SSH

SSHINTERMEDIATEMEDIUMUpdated Jan 4, 2026· 164 views

The SSH agent is running but has no private keys loaded. This error occurs when attempting to use ssh-add without first adding SSH keys to the agent. Fix by generating SSH keys, starting the SSH agent, and explicitly adding your keys.

Quick fix

Fixes ssh-add: No identities found

ls -la ~/.ssh
  1. Check if SSH keys already exist
  2. List identities currently in the SSH agent
  3. Generate SSH keys (if none exist)
  4. Start the SSH agent and add your key
ssh — error
ls -la ~/.ssh
ssh-add: No identities found

What this error means

This error means the SSH agent (the background process that manages authentication credentials) is running, but it does not have any private SSH keys registered with it. When you run ssh-add without arguments, it attempts to load default key files (~/.ssh/id_rsa, ~/.ssh/id_ed25519, etc.), but if those files do not exist or the agent cannot find them, it displays "No identities found". This typically indicates either that SSH keys were never generated on your system, or that they are stored in a non-standard location that ssh-add cannot discover.

Typical symptoms

  • Running ssh-add -l shows "The agent has no identities" instead of listing keys
  • ssh-copy-id fails with "ERROR: No identities found"
  • SSH authentication fails when trying to connect to remote servers
  • Git operations over SSH fail with authentication errors
  • No output or feedback when running ssh-add without arguments

Common causes

  1. SSH keys have never been generated on the system
  2. The SSH private key files are in a non-standard location that ssh-add does not check by default
  3. SSH key files were deleted or moved
  4. The SSH agent is not properly configured or is using a different authentication socket
  5. On macOS, SSH keys were not restored to the keychain after a reboot

How to fix "ssh-add: No identities found"

1Check if SSH keys already exist

First, verify whether SSH keys are already present on your system:

bash
ls -la ~/.ssh

Look for files named id_rsa, id_ed25519, id_ecdsa, or similar. If you see these files, proceed to Step 2. If the directory is empty or does not exist, proceed to Step 3.

2List identities currently in the SSH agent

Check what keys the SSH agent currently has loaded:

bash
ssh-add -l

This will show all identities the agent has. If you get "The agent has no identities", it confirms the agent is running but needs keys added. If you get "Could not open a connection to your authentication agent", the agent is not running — see Step 4.

3Generate SSH keys (if none exist)

If SSH keys do not exist, generate a new key pair:

bash
ssh-keygen -t ed25519 -C "your_email@example.com"

For older systems that do not support Ed25519, use RSA:

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

Press Enter to save to the default location (~/.ssh/id_ed25519), then enter a passphrase for extra security (or leave blank for no passphrase).

4Start the SSH agent and add your key

Ensure the SSH agent is running and add your private key:

bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

(Replace id_ed25519 with id_rsa if you generated an RSA key.) If the key has a passphrase, you will be prompted to enter it. After successful entry, run ssh-add -l again to verify the key is loaded.

5Fix file permissions if necessary

SSH is strict about permissions for security. Set correct permissions on your keys:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub

If the agent still reports "No identities found" after correcting permissions, try removing and re-adding the key:

bash
ssh-add -d ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519
6Configure persistent key loading (optional but recommended)

To avoid having to manually add keys after each session, add this to your ~/.ssh/config file:

bash
Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519

On macOS Sierra and later, also add UseKeychain yes to store the passphrase in the system keychain:

bash
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

This ensures keys are automatically added to the agent for future sessions.

Advanced notes

On macOS Sierra and later, the ssh-add -K command no longer persists keys in the keychain by default. If you want your passphrase stored in the keychain, ensure UseKeychain yes is in your ~/.ssh/config. However, Apple aligned macOS behavior with mainstream OpenSSH, so manual key addition after reboot may still be necessary. For systems using alternative SSH tools or hardware security keys (FIDO2), the SSH agent behavior may differ; consult the tool-specific documentation. If ssh-agent itself is not running (error code 2), you may need to start it in your shell rc file or use a session manager like systemd user services.

Frequently asked questions

What does "ssh-add: No identities found" mean?
This error means the SSH agent (the background process that manages authentication credentials) is running, but it does not have any private SSH keys registered with it. ), but if those files do not exist or the agent cannot find them, it displays "No identities found". This typically indicates either that SSH keys were never generated on your system, or that they are stored in a non-standard location that ssh-add cannot discover.
How do I fix "ssh-add: No identities found"?
The SSH agent is running but has no private keys loaded. This error occurs when attempting to use ssh-add without first adding SSH keys to the agent. Fix by generating SSH keys, starting the SSH agent, and explicitly adding your keys.
What causes "ssh-add: No identities found"?
SSH keys have never been generated on the system The SSH private key files are in a non-standard location that ssh-add does not check by default SSH key files were deleted or moved
Is the "ssh-add: No identities found" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading