git 无法克隆 github 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35252052/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot clone github repository
提问by u123
Based on this guide: https://github.com/cytoscape/cytoscape
基于本指南:https: //github.com/cytoscape/cytoscape
I am running a script on Ubuntu that clones a set of github repositories: https://github.com/cytoscape/cytoscape/blob/develop/cy.sh
我在 Ubuntu 上运行一个脚本来克隆一组 github 存储库:https: //github.com/cytoscape/cytoscape/blob/develop/cy.sh
It fails with:
它失败了:
$ ./cy.sh init
Target directory =
Cytoscape project will be cloned to: /home/user/projects/cytoscape
Cloning: parent (URI = [email protected]: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
If I instead from command line do:
如果我从命令行改为:
git clone https://github.com/cytoscape/cytoscape-parent.git
it works.
有用。
on what systems does:
在什么系统上:
git clone [email protected]:cytoscape/cytoscape-parent.git
work?
工作?
回答by the_unknown_spirit
git clone [email protected]:cytoscape/cytoscape-parent.git
command means you want to clone using SSH URLs . SSH URLs provide access to a Git repository via SSH which is a secure protocol. To use these URLs, you must generate an SSH keypair on your computer and add the public key to your GitHub account. Go through this for setting up an SSH keypair. Generating an SSH key
git clone [email protected]:cytoscape/cytoscape-parent.git
命令意味着您要使用 SSH URL 进行克隆。SSH URL 提供通过 SSH 访问 Git 存储库的权限,SSH 是一种安全协议。要使用这些 URL,您必须在您的计算机上生成一个 SSH 密钥对并将公钥添加到您的 GitHub 帐户。完成此操作以设置 SSH 密钥对。生成 SSH 密钥
回答by orip
The script defaults to cloning an SSH url. Setting up the SSH keys has been linked to in another answer. Your other alternative is:
该脚本默认克隆 SSH url。设置 SSH 密钥已链接到另一个答案。您的另一种选择是:
- Change the script to clone HTTP URLs which don't require this setup. In your particular case you should be cloning https://github.com/cytoscape/cytoscape-parent.git
- Send a patch to the project to change the default, making cloning easier for casual users.
- 更改脚本以克隆不需要此设置的 HTTP URL。在您的特定情况下,您应该克隆https://github.com/cytoscape/cytoscape-parent.git
- 向项目发送补丁以更改默认值,使临时用户更容易克隆。