简体   繁体   English

想要将私有存储库克隆到本地计算机。 (第一次使用命令行git。)

[英]Would like to clone private repo to local computer. (first time using command line git.)

I would like to clone a private already existing repo to my local server. 我想将私有的现有存储库克隆到我的本地服务器。 I've tried a series of commands to no avail. 我尝试了一系列命令都没有用。

[user@BC-01 gitTEST]$ git clone https://github.com/*****/Clinical.git
Initialized empty Git repository in /home/dir/gitTEST/Clinical/.git/
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/*****/Clinical.git/info/refs

fatal: HTTP request failed

[user@BC-01 gitTEST]$ git clone https://user:pwrdgit@github.com/*****/Clinical.git
Initialized empty Git repository in /home/dir/gitTEST/Clinical/.git/
error: The requested URL returned error: 403 Forbidden while accessing https://user:pwrdgit@github.com/*****/Clinical.git/info/refs

fatal: HTTP request failed

[user@BC-01 gitTEST]$ git clone user@github.com:*****/Clinical.git
Initialized empty Git repository in /home/dir/gitTEST/Clinical/.git/
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

How can I get this private repo cloned? 我怎样才能克隆这个私人仓库?

I recommend using SSH key authentication, so you do not need to type in your login and password everytime you connect to GitHub. 我建议使用SSH密钥身份验证,因此您无需在每次连接GitHub时都输入登录名和密码。 First follow the documentation to setup SSH authentication . 首先,按照文档设置SSH身份验证

Then use the clone command with SSH link to your repo and it should work. 然后使用带有SSH链接到您的存储库的clone命令,它应该可以工作。

[user@BC-01 gitTEST]$ git clone git@github.com:<username>/Clinical.git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM