为什么不能从我的私有存储库克隆?

时间:2018-07-31 21:25:01

标签: windows git

我在主要开发计算机(Linux)上有一个git存储库,我经常git push到远程SSH服务器进行备份。我现在想在Windows计算机上对该存储库进行一些工作。因此,我安装了Windows版Git,设置了SSH密钥等。

从Git Bash,我可以ssh毫无问题地进入服务器。但是,这失败了:

$ git clone --config=core.symlinks=true -- user@host:/private/site.git destination
Cloning into 'destination'...
Enter passphrase for key '/c/Users/username/.ssh/id_rsa':
fatal: '/private/site.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我已经确定我提供了正确的用户名,主机名和路径,因为我已经对其进行了两次和三次检查。我已经检查了/private/site.git上的权限,它们没问题:我的用户帐户具有读写访问权限。我通常会从另一台计算机正常推送到远程存储库,因此显然配置正确。我在做什么错了?

2 个答案:

答案 0 :(得分:1)

事实证明,尽管进行了多次检查,但我提供的主机路径错误。直到登录主机进行其他检查后,我才注意到它。天啊

答案 1 :(得分:0)

首先,要进行测试,请定义一个没有密码的私钥

然后确保将您的公钥发布到host@~user/.ssh/authorized_keys(作为一行,而不是多行:副本可能很棘手)

最后,检查您的密钥是否确实用于:

cmd /v /c "GIT_SSH_COMMAND=ssh -v&& git clone user@host:/private/site.git destination"