无法访问私有github仓库(我有公钥和私钥)

时间:2017-12-10 02:32:37

标签: github ssh ssh-keys

我需要访问(克隆)GitHub上的私有存储库,该存储库属于我无法与之通信的开发人员。我已经获得了公钥和私钥(我猜他们可能是为特定存储库部署密钥?)

运行以下终端命令后:

git clone git@github.com:theirusername/reponame.git

我收到以下错误:

Cloning into 'reponame'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

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

开发人员还在自述文件中包含以下注释: 开发人员备注(用' x'替换敏感信息)

===============
"This SSH public/private keypair allows full access to the server.
DO NOT GIVE THESE FILES TO ANYONE THAT YOU DON'T WANT ACCESSING YOUR ENTIRE SERVER AND ASSOCIATED SERVICES.

- The SSH port is XXXXX.
- There is no passphrase on the keys.
- The keys allow access to two users: `xxx` (standard privs) and `xxx` (for sudo and su-ing to root)
- These keys also allow access to the GitHub repository: github.com/theirusername/reponame.git"

我已经尝试将公钥添加到我的Github帐户(在设置 - > SSH和GPG密钥下)。这似乎没有帮助解决这个问题。

我确定有一些根本的东西,我没有抓住这里。我是否需要公钥和私钥才能访问回购?如果是这样,我在哪里注册每个?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

您需要在家中存储公钥和私钥(~/.ssh

然后,您可以使用ssh -T git@github.com测试连接:如果这些密钥来自其他开发人员,则应显示包含其他开发人员名称的欢迎消息(因为公钥应在其GitHub帐户下注册)

如果您有多个密钥,则需要~/.ssh/config fileas I describe here