Search code examples
gitcygwinmsysgit

Git push/pull paths not working to windows origin running msysgit + cygwin sshd


In trying to resolve the issue I was having for: managing website on windows using git, I installed Cygwin openssh and Git for Windows (msysgit) on a Windows 2008 server (let's call this myserver).

I have a bare git repo setup at the cygwin path /var/git/example.git, which maps to c:\cygwin\var\git\example.git on Windows.

I have a user git that has permission on the repo's folders.

I am able to login with git using key-based authentication to myserver from my XP workstation using Putty. I have the key opened in pageant.

I am able to use cygwin style paths in Putty, so for example cd /var/git/example.git gets me to my bare repo.

However, I have a problem when I use Git Bash (MingW32) and attempt to do:

git clone ssh://git@myserver/var/git/example.git

I get the response:

Cloning into example...
fatal: '/var/git/example.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

When I try:

git clone ssh://git@myserver:c:/cygwin/var/git/example.git

It works and the repo gets cloned.

Cloning into example...
remote: Counting objects: 384, done.
remote: Compressing objects: 100% (288/288), done.
remote: Total 384 (delta 85), reused 359 (delta 73)
Receiving objects: 100% (384/384), 51.72 MiB | 201 KiB/s, done.
Resolving deltas: 100% (85/85), done.

However, if I then try to push using:

cd example
git push

It fails:

git: '/cygwin/var/git/example.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

So how do I make this work so I can push/pull/clone? Ideally I would like to be able to use the Cygwin path style, eg. git clone ssh://git@myserver/var/git/example.git.


Solution

  • Dunno if this was resolved, but I have finally succeeded in getting this to work and have shared my answer on the other thread:

    https://stackoverflow.com/a/10509588