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

こ雲淡風輕ζ 提交于 2019-12-10 10:08:13

问题


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.


回答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




回答2:


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.




回答3:


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


来源:https://stackoverflow.com/questions/9263410/git-push-pull-paths-not-working-to-windows-origin-running-msysgit-cygwin-sshd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!