Peter Meth
Peter Meth

Reputation: 395

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.

Upvotes: 3

Views: 3256

Answers (3)

Pada
Pada

Reputation: 646

I also had this issue, because I'm running Putty, WinSCP, TortoiseSVN and TortoiseGIT with a shared pageant between them all.

I fixed this issue by changing the GIT_SSH from the Putty\plink.exe one to TortoiseSVN\bin\TortoisePlink.exe eg.

set GIT_SSH=C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe

Upvotes: 0

cache
cache

Reputation: 26

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

Upvotes: 1

gjcamann
gjcamann

Reputation: 651

I have experienced similar problems recently with cygwin git not working corectly. I installed msysgit. Then for things to work I need to do all my git work from a msysgit shell. From my experience most things work under a dos shell, but pushing does not. I recommend starting over and using the msysgit bash shell to clone a new repo and use that shell for all git commands, then pushing will likely work.

Upvotes: 0

Related Questions