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

并且存储库存在。


当前回答

对于Fedora 33+和Bitbucket用户:

出现这个问题是因为哈希算法过时了。正如Bitbucket上提到的,有两种选择:

选项1:

添加到~/。ssh / config文件。(如果文件不存在,就创建它。)

Host bitbucket.org
  PubkeyAcceptedKeyTypes +ssh-rsa

选项2:

使用更安全的算法。

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

其他回答

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

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

我得到了错误…

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

...当我的笔记本电脑因为Windows 10的错误更新而死机并被返回出厂设置后,我试图通过Git Bash提示与Bitbucket进行联系。我已经从备份中恢复了所有的ssh文件。

错误的原因原来是在电脑重建后,我的Windows帐户名不匹配。我了解到公钥文件id_rsa。pub以一个易于阅读的字符串结束,它包括我的Windows帐户名,后面跟着@符号,然后是计算机名。

当我最初设置我的电脑时,我创建了我的Windows帐户名,其中包括我的中间首字母,但当我的电脑重置为出厂设置时,我们新的DevOps人员创建了我的帐户名,其中没有我的中间首字母。

为了解决这个问题,我简单地编辑了我的公钥文件id_rsa。把我名字中间的首字母去掉了。我坚持使用相同的计算机名,所以没关系。我将文件内容复制到Windows剪贴板。然后我登录到Bitbucket,在我的头像下进入Bitbucket设置,并添加了一个新的公钥,在那里我粘贴了新的内容。

回到Git Bash提示,我通过输入命令确认它现在可以工作了…

ssh -T git@bitbucket.org

...然后我收到了我已经登录的消息

在为gitlab设置ssh时,我也遇到了同样的问题。我已经有ssh的github和我不能覆盖。 对我有效的步骤是:

生成带有新路径的SSH并添加到SSH列表SSH -add /path/to/new/id_rsa。 在~/中创建一个名为config的文件。ssh /使用。我使用vi ~/.ssh/config/。 将其添加到新创建的文件中

GitLab com服务器 主机gitlab。com RSAAuthentication赛 IdentityFile path / to / new / id_rsa

保存并退出。

在那之后,重新启动终端并尝试按,它应该工作

我在Mac上遇到过这个问题——当我正确地设置SSH来访问我的Git存储库时,重启后(有一段时间Mac处于僵局),我的所有凭据都被删除了。显然,由于某种原因,酒吧钥匙被设置为644,导致它从钥匙链中被删除。readd:

Chmod 600公钥 ssh-add ~ /。Ssh /[您的私钥]-这应该显示身份已添加。您想要的密钥文件是没有.pub扩展名的密钥文件。 Ssh-add -l将显示新添加的标识

编辑:显然MacOS有删除密钥的倾向-下载High Sierra更新后(但我还没有安装它),我的密钥被删除了,我必须通过ssh-add重新添加它