1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/content/github/authenticating-to-github/error-key-already-in-use.md
Jason Etcovitch caaee7a124 Update all files to use {% data %} (#15253)
* Add back changes from prior to purge

* Manually fix some invalid Liquid

* Updoot render-content

* Improve test messages to show correct output

* Run el scripto

* Pass the remaining test
2020-09-29 16:01:04 -04:00

1.7 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
Error: Key already in use This error occurs when you try to [add a key](/articles/adding-a-new-ssh-key-to-your-github-account) that's already been added to another account or repository.
/articles/error-key-already-in-use
free-pro-team enterprise-server
* *

Finding where the key has been used

To 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:

$ ssh -T -ai <em>~/.ssh/id_rsa</em> git@{% data variables.command_line.codeblock %}
# Connect to {% data variables.product.product_location %} using a specific ssh key
> Hi <em>username</em>! You've successfully authenticated, but GitHub does not
> provide shell access.

The username in the response is the {% data variables.product.product_name %} account 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.

Fixing the issue

To resolve the issue, first remove the key from the other account or repository and then add it to your account.

If 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.

Deploy keys

Once 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."