git clone on windows

2019-07-17 02:01发布

问题:

I have installed an SSH server on Windows Server 2008, and initialized a 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:

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

How does the path really work in windows?

回答1:

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

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

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?".

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

As the OP JohnZ mentions in the comments:

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:

git clone "ssh://root@192.168.1.1/cygdrive/c/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/myrepofolder"


标签: windows git ssh