简体   繁体   English

无法使用SSH克隆远程存储库

[英]Cannot clone remote repository with SSH

I'm new to using Git and I am trying to understand why I cannot clone a remote repository using SSH. 我是使用Git的新手,我试图了解为什么我无法使用SSH克隆远程存储库。 When I try to, it states that the System Cannot find the path specified. 当我尝试这样做时,它指出系统找不到指定的路径。

 git clone -u /mingw64/bin/git-upload-pack ssh://administrator@10.20.32.7/Git/quizinator 

However, I can clone the repository just fine using the following command. 但是,我可以使用以下命令克隆存储库。

 git clone -u /mingw64/bin/git-upload-pack file:////10.20.32.7/Git/quizinator 

I've tried creating the a repo under the program files and even under the user account and I always get the same results. 我试过在程序文件下甚至在用户帐户下创建一个仓库,我总是得到相同的结果。 I just do not understand why one method works and the other does not. 我只是不明白为什么一种方法有效而另一种无效。

When you use a file:// URL, the -u argument to git clone is ignored : 当您使用file:// URL时, git clone-u参数将被忽略

--upload-pack <upload-pack> , -u <upload-pack> --upload-pack <upload-pack>-u <upload-pack>
When given, and the repository to clone from is accessed via ssh, this specifies a non-default path for the command run on the other end. 如果指定了要克隆的存储库,则可以通过ssh访问该存储库,这将为另一端运行的命令指定非默认路径。

(emphasis mine). (强调我的)。 The file:// URL makes your Git do all the work itself (your Git acts as both sender and receiver), so the file:// clone is quite unrelated to anything SSH-ish. file:// URL使您的Git自己完成所有工作(您的Git既充当发送者又充当接收者),因此file://克隆与任何类似SSH的东西都不相关。

Given the URL, you might try: 给定URL,您可以尝试:

ssh administrator@10.20.32.7 ls -l /mingw64/bin/git-upload-pack

to see what the other machine thinks about /mingw64/bin/git-upload-pack (I'm asssuming ls -l will work due to mingw64; I don't "do" Windows though). 看看另一台机器对/mingw64/bin/git-upload-pack看法(我假设ls -l由于mingw64而可以工作;尽管我不“做” Windows)。 If that works, you can then try: 如果可行,您可以尝试:

ssh administrator@10.20.32.7 ls -ld Git/quizinator

to see what it thinks of that. 看看它的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM