SSH offered the server more keys than it allows before reaching the correct one. With several identities loaded in the agent, the server hits its max-auth-tries limit and disconnects before the right key is tried.
What this error means
An SSH clone fails with Received disconnect from ...: Too many authentication failures. It happens when the runner’s agent holds multiple keys and the deploy key is not offered first.
git clone output
Received disconnect from 140.82.x.x port 22:2: Too many authentication
failures
Disconnected from 140.82.x.x port 22
fatal: Could not read from remote repository.
Diagnose it: depth, refs, or credentials?
Terminal
git rev-parse --is-shallow-repository
git rev-parse --abbrev-ref HEAD # prints HEAD when detached
git log --oneline -3
git remote -v
Common causes
The agent offers too many keys
SSH tries each identity in the agent in turn. If several keys are loaded, the server may exceed its MaxAuthTries and disconnect before the correct key is reached.
The right key is not prioritized
Without IdentitiesOnly, SSH ignores an explicit IdentityFile and still offers every agent key first, wasting auth attempts.
How to fix it
Force only the intended key
Use IdentitiesOnly with the specific key so SSH offers just that one.
Start a clean agent and add only the deploy key (ssh-add -D then ssh-add ~/.ssh/deploy_key).
Or set IdentitiesOnly yes and IdentityFile for the host in ~/.ssh/config.
Avoid loading unrelated keys onto CI runners.
How to prevent it
Load only the key a job needs into the agent.
Set IdentitiesOnly yes per host in ~/.ssh/config.
Use the checkout action’s ssh-key input, which scopes to a single key.
Frequently asked questions
What causes Git SSH "Too many authentication failures" in CI?
There are 2 common causes: the agent offers too many keys and the right key is not prioritized. SSH tries each identity in the agent in turn.
How do I fix Git SSH "Too many authentication failures" in CI?
There are 2 fixes depending on which cause you have: force only the intended key and limit the agent to the deploy key. Work through them in order, since the first is the most common.
What does Git SSH "Too many authentication failures" in CI actually mean?
An SSH clone fails with Received disconnect from ...: Too many authentication failures.
How do I stop Git SSH "Too many authentication failures" in CI happening again?
Load only the key a job needs into the agent. The prevention section lists 3 changes that keep it from recurring.