{"meta":{"title":"错误：密钥已被使用","intro":"尝试添加已添加到其他帐户或存储库的密钥时，会发生此错误。","product":"身份验证","breadcrumbs":[{"href":"/zh/enterprise-cloud@latest/authentication","title":"身份验证"},{"href":"/zh/enterprise-cloud@latest/authentication/troubleshooting-ssh","title":"SSH 故障排除"},{"href":"/zh/enterprise-cloud@latest/authentication/troubleshooting-ssh/error-key-already-in-use","title":"错误：密钥已被使用"}],"documentType":"article"},"body":"# 错误：密钥已被使用\n\n尝试添加已添加到其他帐户或存储库的密钥时，会发生此错误。\n\n## 查找已使用密钥的位置\n\n要确定已使用该密钥的位置，请打开终端并键入 `ssh` 命令。 使用 `-i` 标记提供要检查的密钥的路径：\n\n```shell\n$ ssh -T -ai ~/.ssh/id_rsa git@github.com\n# Connect to GitHub.com using a specific ssh key\n> Hi USERNAME! You've successfully authenticated, but GitHub does not\n> provide shell access.\n```\n\n响应中的\\_用户名\\_是密钥所属的GitHub.com上的帐户。 如果响应类似于“username/repo”，则表示密钥已作为\\_部署密钥\\_附加到存储库。\n\n要强制 SSH 仅使用命令行上提供的密钥，请使用 `-o` 添加 `IdentitiesOnly=yes` 选项：\n\n```shell\nssh -v -o \"IdentitiesOnly=yes\" -i ~/.ssh/id_rsa git@github.com\n```\n\n## 修复问题\n\n为解决此问题，请先从其他帐户或存储库删除该密钥，然后[将其添加到帐户](/zh/enterprise-cloud@latest/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)。\n\n如果没有传输密钥的权限，并且无法联系到有权限的用户，请删除密钥对并[生成全新的密钥对](/zh/enterprise-cloud@latest/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)。\n\n## 部署密钥\n\n在密钥作为部署密钥附加到一个仓库后，无法再用于另一个仓库。 如果在设置部署密钥时出现此错误，请参阅“[管理部署密钥](/zh/enterprise-cloud@latest/authentication/connecting-to-github-with-ssh/managing-deploy-keys)”。"}