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

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

我想将一个已经存在的私有存储库克隆到我的本地服务器。我尝试了一系列命令无济于事。

[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

如何克隆这个私人仓库?

我建议使用 SSH 密钥身份验证,这样您就不需要在每次连接到 GitHub 时都输入您的登录名和密码。首先按照文档setup SSH authentication.

然后使用带有 SSH link 的克隆命令到您的存储库,它应该可以工作。

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