我无法克隆一个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

并且存储库存在。


当前回答

通过浏览器登录bitbucket后, 我推到原点开始工作。

其他回答

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 GUI客户端生成密钥。将此密钥复制到剪贴板。 在bitBucket/ git网站上打开您的帐户,并将此密钥添加到您的配置文件中。这样,服务器就知道您是从合法系统访问的合法用户。 就是这样。从此以后,所有的推命令都对我有用。

对于来这里只是想获取存储库但不关心协议(ssh / https)的人,您可能只想使用https而不是ssh(如果支持ssh的话)。

举个例子

git clone https://github.com/%REPOSITORYFOLDER%/%REPOSITORYNAME%.git

而不是

git clone git@github.com:%REPOSITORYFOLDER%/%REPOSITORYNAME%.git

请注意,GitHub已弃用私人存储库的密码认证(https登录),因为它没有跟上最新的安全标准,使用个人访问令牌。

还需要注意的是,自2022年3月1日起,Bitbucket用户也不能再通过git通过https使用他们的Atlassian帐户密码,而是需要使用Bitbucket应用程序密码。

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

sudo chown -R ubuntu:ubuntu /var/projects