Windows 上的 git 克隆

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8050338/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 08:54:37  来源:igfitidea点击:

git clone on windows

windowsgitssh

提问by John Zumbrum

I have installed an SSH server on Windows Server 2008, and initialized a git repo.

我已经在 Windows Server 2008 上安装了一个 SSH 服务器,并初始化了一个 git repo。

I'd like to clone this on my dev environment, so that I can commit and push changes.

我想在我的开发环境中克隆它,以便我可以提交和推送更改。

Having trouble figuring out the path; here's what I see in every example:

无法确定路径;这是我在每个示例中看到的内容:

home$ git clone ssh://myuser@server/path/to/repository

That's great and all, but I don't understand how to use that for windows. This seems wrong to me:

这很好,但我不明白如何在 Windows 上使用它。这对我来说似乎是错误的:

home$ git clone ssh://myuser@server/Program Files (x86)/Apache/Apache/htdocs/myrepo

How does the path really work in windows?

路径如何在 Windows 中真正起作用?

采纳答案by VonC

If you have followed the tutorial Setting up a Msysgit Server with copSSH on Windows, I confirm your "Program Files (x86)" can work.

如果您按照教程在 Windows 上使用 copSSH 设置 Msysgit 服务器,我确认您的“ Program Files (x86)”可以工作。

See for instance SO answer "Git clone using ssh - can't find repository":

例如,请参阅 SO 答案“使用 ssh 进行 Git 克隆 - 找不到存储库”:

git clone "ssh://steve@test:4837/Program Files (x86)/ICW/home/steve/vc/git/depo/test.git" 
          /c/dev/es/app/

You will find other path examples in "How to stop git via ssh on windows from resolving the wrong path?".

您将在“如何在 Windows 上通过 ssh 阻止 git 解决错误路径?”中找到其他路径示例。

Using Openssh rather than plink.exe is easier though: see "Setting up a Git server with Windows Server 2008".

不过,使用 Openssh 而不是 plink.exe 更容易:请参阅“使用 Windows Server 2008 设置 Git 服务器”。

As the OP JohnZmentions in the comments:

正如OP JohnZ在评论中提到的:

Looks like this depends a little bit on the ssh server you use.
I installed CYGWIN, which has openSSH installed.
To clone it, I did this:

看起来这有点取决于您使用的 ssh 服务器。
我安装了 CYGWIN,它安装了 openSSH。
为了克隆它,我这样做了:

git clone "ssh://[email protected]/cygdrive/c/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/myrepofolder"