Interview Prep/Git & GitHub/Authentication and Remote Access

Adding a deploy key to a second repository fails with "Key is already in use".

IntermediateTroubleshootingAuthentication and Remote Access
Answer

Likely causes → GitHub allows a given public key to be a deploy key on only one repository (and it cannot also be a user key).

Diagnose → Compare fingerprints: ssh-keygen -lf key.pub and check the other repo's deploy keys.

Fix → Generate a separate key per repo (ssh-keygen -t ed25519 -f ~/.ssh/deploy_repo2) and use host aliases in ~/.ssh/config to select them. For many repos, use a GitHub App or a machine account instead.

Prevent → Naming keys by repo in secrets management avoids reuse attempts.

All Git & GitHub questions Roadmap: Git & GitHub

More on Authentication and Remote Access