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

并且存储库存在。


当前回答

在为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

保存并退出。

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

其他回答

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

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

如果全部失败,就像我的情况一样,卸载GIT,重新安装。出于某种原因,这是固定的。

注:

我尝试生成新的密钥和更新SSH公钥 还尝试删除所有键,并尝试创建一个新键。 没有,我的.gitconfig没有问题

克隆时,我有一个类似的问题[我的错误: 权限被拒绝(公钥)。 无法从远程存储库读取。 请确保您有正确的访问权限。等 ]

我使用的是bitBucket/UBUNTU14.04,但是我已经有了一组我之前生成的密钥文件,并且我已经更改了文件的名称。我简单地将文件复制到标准id_rsa和id_rsa。Pub名称格式。然后我重新运行该命令,没有问题。

OBTW:我也可以通过使用HTTP样式的克隆来使用密码提示。

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