我无法克隆一个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密钥并重新启动并尝试了所有其他“n”解决方案。但对我来说,真正的问题是我们的gitlab默认协议从ssh变成了https。

检查远程url

git remote -v

更改远程url

git remote set-url origin https://URL

其他回答

如果在创建SSH并将其添加到您的Bitbucket帐户或其他地方后仍然存在访问问题,您需要在git, OSX或Linux上的终端上执行以下操作:

# Lists already added identities (‘ssh keys’)
ssh-add -l

然后,如果你没有看到你的密钥列出,添加它与以下(替换身份为其真实名称):

# Add a new identity
ssh-add ~/.ssh/identity

这对我很管用。

如果这些答案都没用

你使用的是Windows 您可以使用Putty生成密钥,或者已经安装了Putty 你的电脑 你可以用CMD或PowerShell生成密钥

Try

删除你的钥匙 在windows上搜索Git Bash,然后生成一个 Git Bash命令行中的新密钥 添加公钥到您的在线回购

然后,你会发现git克隆后,输入yes确认,它应该开始克隆

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

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

我在GitHub上也遇到了同样的问题。下面是解决方法!

在您的计算机上生成一个SSH密钥,如下所述:生成SSH密钥。 登录您的GitHub帐户:GitHub Login。 在您的帐号中添加新生成的“SSH Key: My account SSH Key”。 再次尝试git克隆项目。