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

并且存储库存在。


当前回答

对于来这里只是想获取存储库但不关心协议(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应用程序密码。

其他回答

如果你生成新的公共ssh密钥并插入到bitbucket或github和

没用,请重新启动你的电脑。它帮助了我!!

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

对于来这里只是想获取存储库但不关心协议(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应用程序密码。

如果你想克隆开源项目来提交一个Pull Request:

我想克隆一个开源项目,这样我就可以提交一些pull请求。问题是我没有项目所有者的许可。没关系,因为我的目的是提交一份PR,这里有一个可行的替代方案:

我的解决方案:

叉库

然后从你的分叉库克隆。 完善你的功能,然后提交一个pull request。

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

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