{"meta":{"title":"Error: Key already in use","intro":"This error occurs when you try to add a key that's already been added to another account or repository.","product":"Authentication","breadcrumbs":[{"href":"/en/enterprise-server@3.22/authentication","title":"Authentication"},{"href":"/en/enterprise-server@3.22/authentication/troubleshooting-ssh","title":"Troubleshooting SSH"},{"href":"/en/enterprise-server@3.22/authentication/troubleshooting-ssh/error-key-already-in-use","title":"Error: Key already in use"}],"documentType":"article"},"body":"# Error: Key already in use\n\nThis error occurs when you try to add a key that's already been added to another account or repository.\n\n## Finding where the key has been used\n\nTo determine where the key has already been used, open a terminal and type the `ssh` command. Use the `-i` flag to provide the path to the key you want to check:\n\n```shell\n$ ssh -T -ai ~/.ssh/id_rsa git@HOSTNAME\n# Connect to your GitHub Enterprise Server instance using a specific ssh key\n> Hi USERNAME! You've successfully authenticated, but GitHub does not\n> provide shell access.\n```\n\nThe *username* in the response is the account on your GitHub Enterprise Server instance that the key is currently attached to. If the response looks something like \"username/repo\", the key has been attached to a repository as a [*deploy key*](/en/enterprise-server@3.22/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys).\n\nTo force SSH to use only the key provided on the command line, use `-o` to add the `IdentitiesOnly=yes` option:\n\n```shell\nssh -v -o \"IdentitiesOnly=yes\" -i ~/.ssh/id_rsa git@HOSTNAME\n```\n\n## Fixing the issue\n\nTo resolve the issue, first remove the key from the other account or repository and then [add it to your account](/en/enterprise-server@3.22/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\n\nIf you don't have permissions to transfer the key, and can't contact a user who does, remove the keypair and [generate a brand new one](/en/enterprise-server@3.22/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).\n\n## Deploy keys\n\nOnce a key has been attached to one repository as a deploy key, it cannot be used on another repository. If you're running into this error while setting up deploy keys, see [Managing deploy keys](/en/enterprise-server@3.22/authentication/connecting-to-github-with-ssh/managing-deploy-keys)."}