【发布时间】:2018-07-14 04:23:32
【问题描述】:
我在 Windows 10 系统上设置了 Win32-OpenSSH,并且我正在使用 Git for Windows 2.16.1。
我创建了一个裸测试存储库,我可以通过文件 URL 从中很好地克隆:
git clone file:///c:/test.git
Cloning into 'test'...
remote: Counting objects: 33, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 33 (delta 11), reused 0 (delta 0)
Receiving objects: 100% (33/33), done.
Resolving deltas: 100% (11/11), done.
SSHD 也运行良好,我可以从平板电脑打开一个 shell,并通过 SFTP 访问存储库目录:
> sftp oli@localhost
oli@localhost's password:
Connected to oli@localhost.
sftp> pwd
Remote working directory: /C:/Users/Oli
sftp> cd /c:/test.git
sftp> pwd
Remote working directory: /c:/test.git
sftp> ls
HEAD config description hooks info objects packed-refs refs
sftp> bye
但是由于某种原因,通过 SSH 克隆失败:
> git clone ssh://oli@localhost:22/c:/test.git
Cloning into 'test'...
oli@localhost's password:
fatal: ''/c:/test.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.
用户“Oli”肯定拥有正确的访问权限,我们在上面已经看到存储库存在并且是一个有效的 Git 存储库。我还在路径上尝试了许多不同的语法变体。
我已经阅读了关于 Git/SSH/Windows 的所有问答、Git Pro 书籍、Git 参考、OpenSSH 手册和 Win32-OpenSSH wiki。
我错过了什么?
【问题讨论】:
-
这里有什么帮助吗? stackoverflow.com/questions/1092583/…
-
是的!解决方案在 Konstantin 给出的答案中:问题是 - cmd.exe 不理解单引号参数。按照他的建议使用自定义上传命令时,克隆终于起作用了。