我无法克隆一个Git存储库,并得到这个错误:

krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://stage.abc.com:10088/pqr
http://<url>/<repository> Cloning into '<repository>'... fatal: could not read Username for 'http://<url>': No such file or directory

我读过Bitbucket, Windows和“致命:无法读取密码”,但仍然有问题。

我继续前进,但现在得到这个错误

sh.exe": chown: command not found

krishna.soni@KRISHNACHANDRAS /c
$ git clone ssh://krishna.sonipayu.in@stage.payupaisa.
/projects
Cloning into 'C:/projects'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

> krishna.soni@KRISHNACHANDRAS /c
>     $ git clone ssh:<url>
>     ts
>     Cloning into 'C:/projects'...
>     Permission denied (publickey).
>     fatal: Could not read from remote repository.

Please make sure you have the correct access rights

并且存储库存在。


当前回答

在更改我克隆的文件夹的权限后,它工作了:

sudo chown -R ubuntu:ubuntu /var/projects

其他回答

对我来说,当我想从我的存储库克隆时,我在“权限被拒绝(publickey)致命:无法从远程存储库读取”之前注意到相同的消息。对于我的情况的解决方案是不使用sudo之前克隆,就是这样。

macOS / Linux (Ubuntu):

1. 要进行身份验证,您需要从您的用户设置中将您的SSH密钥对的公共部分添加到bitbucket:用户设置——> SSH密钥

你可以在你的~/中找到上述公共部分。SSH目录,通常为id_rsa。酒吧。注意文件名的.pub部分为Public。 如果你还没有,它会帮助你生成一个

你还没有完成…

2. 您需要让系统知道对哪个远程主机使用哪个键,因此将这些行添加到~/中。ssh / config文件

Host bitbucket.org
 IdentityFile ~/.ssh/PRIVATE_KEY_FILE_NAME

其中PRIVATE_KEY_FILE_NAME是您的SSH密钥对的私有部分的名称,如果您没有乱动它,通常它的默认名称是:id_rsa 在这种情况下,将上面的PRIVATE_KEY_FILE_NAME替换为id_rsa(私钥没有.pub扩展名)

Github(或Bitbucket)在他们的服务器上找不到你的ssh密钥。

只需在您的帐户设置中添加您的密钥。

我一直面临着同样的问题,突然间我突然想到哪里会出问题。

在您的计算机上生成一个SSH密钥,如下所述:生成 SSH密钥。

这就是我做错的地方

在生成ssh密钥时使用下面的命令,但我没有使用sudo,而克隆时我使用的是“sudo git克隆ssh_repo_url”,因为克隆时我需要创建我的用户没有权限的文件夹

生成ssh的错误方法

$ ssh-keygen -t ed25519 -C "your_email@example.com"

正确的方法,如果在克隆时使用sudo

$ sudo ssh-keygen -t ed25519 -C "your_email@example.com"

登录您的GitHub帐户:GitHub Login。 在您的帐号中添加新生成的“SSH Key: My account SSH” 钥匙。 再次尝试git克隆项目。(使用sudo生成的密钥)

我在windows命令行运行git clone命令时遇到了同样的问题。但是该命令在Git Bash中成功运行。