首页 > 解决方案 > 为什么我的第二个私有存储库没有使用我的 GitHub 部署密钥?

问题描述

我有两个私有的 GitHub 存储库和两个各自的具有写访问权限的部署密钥。对于第一个存储库,一切正常,但对于第二个,我总是获得:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

如果我检查我加载的密钥:

ssh-add -E md5 -l

我可以看到这两个密钥的指纹与它们各自的 GitHub 部署密钥页面中的指纹相同。那么为什么我不能推送到第二个存储库?

标签: gitgithubsshssh-keys

解决方案


如果我运行:

ssh -T git@github.com

我看到我已使用第一个存储库的部署密钥进行了身份验证。

要推送到第二个存储库,我必须卸载所有密钥:

ssh-add -D

并添加回第二个存储库的密钥。

然后我可以推送到第二个存储库。


推荐阅读