无法克隆GitHub仓库

3
基于这份指南:https://github.com/cytoscape/cytoscape,我在Ubuntu上运行一个脚本来克隆一组Github存储库:https://github.com/cytoscape/cytoscape/blob/develop/cy.sh。但是它失败了:
$ ./cy.sh init
Target directory = 
Cytoscape project will be cloned to: /home/user/projects/cytoscape
Cloning: parent (URI = git@github.com:cytoscape/cytoscape-parent.git)
Cloning into 'parent'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Could not clone remote repository: /home/user/projects/cytoscape

如果我从命令行中运行以下命令:

git clone https://github.com/cytoscape/cytoscape-parent.git

它可以工作。

在哪些系统上能够运行:

git clone git@github.com:cytoscape/cytoscape-parent.git

工作?


您需要一个SSH密钥来使用SSH URL。请参阅https://help.github.com/articles/generating-an-ssh-key/。 - jonrsharpe
2个回答

10

git clone git@github.com:cytoscape/cytoscape-parent.git命令表示您想使用SSH URL进行克隆。 SSH URL通过SSH提供对Git存储库的访问,这是一种安全协议。 要使用这些URL,您必须在计算机上生成一个SSH密钥对,并将公钥添加到GitHub帐户中。 请按照此过程设置SSH密钥对。生成SSH密钥


2
脚本默认克隆一个 SSH URL。设置 SSH 密钥的方法已在另一个答案中提供链接。你可以选择以下两种替代方案之一:
  1. 更改脚本以克隆不需要此设置的 HTTP URL。在你的情况下,应该克隆 https://github.com/cytoscape/cytoscape-parent.git
  2. 向该项目发送补丁以更改默认设置,使得对于普通用户来说更容易进行克隆操作。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接