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

并且存储库存在。


当前回答

移除远端原点

Git远程删除原点

添加HTTP远程源

其他回答

移除远端原点

Git远程删除原点

添加HTTP远程源

这看起来像是权限问题,而不是Windows 7的问题。

您的ssh密钥未被授权-权限被拒绝(publickey)。

您需要创建一个公共ssh密钥,并请求Git存储库的管理员添加ssh公钥

如何执行此操作的信息:保存ssh密钥失败

解决方案: 在您试图克隆到或从其推送的服务器上 猫~ / . ssh / id_rsa . pub 进入GitHub,设置,SSH和GPG密钥,新的SSH密钥 粘贴键。

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

sudo chown -R ubuntu:ubuntu /var/projects

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