3

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.

Community
  • 1
  • 1
Peter Meth
  • 405
  • 5
  • 12
  • Did you try other paths, like `/cygdrive/c/cygwin/var/git/example.git` – VonC Feb 14 '12 at 08:46
  • yes i tried that and it did not work. – Peter Meth Feb 14 '12 at 13:19
  • Is it because you are trying to use a git (msysgit) which isn't part of cygwin? As in http://stackoverflow.com/a/5875642/6309 ? Although you might try first http://stackoverflow.com/a/2745562/6309: `git config --global remote.origin.receivepack "git receive-pack"` – VonC Feb 14 '12 at 13:41
  • possible duplicate of [git push origin master: 'D:/Projects/TheProject' is not a git command](http://stackoverflow.com/questions/5795013/git-push-origin-master-d-projects-theproject-is-not-a-git-command) – oers May 09 '12 at 07:38

3 Answers3

1

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

Community
  • 1
  • 1
cache
  • 26
  • 1
0

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
Pada
  • 646
  • 5
  • 13
0

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.

gjcamann
  • 621
  • 4
  • 14