Git 推/拉路径不适用于运行 msysgit 的 Windows 源 + cygwin sshd
在尝试解决我遇到的问题时: 使用 git 在 Windows 上管理网站,我在 Windows 2008 服务器(我们称之为 myserver
)上安装了 Cygwin openssh 和 Git for Windows (msysgit)。
我在 cygwin 路径 /var/git/example.git
上有一个裸露的 git 存储库设置,它映射到 c:\cygwin\var\git\example.git
视窗。
我有一个用户 git
,该用户拥有存储库文件夹的权限。
我可以使用 Putty 从我的 XP 工作站使用基于密钥的身份验证通过 git
登录到 myserver
。我在选美比赛中打开了钥匙。
我可以在 Putty 中使用 cygwin 样式路径,例如 cd /var/git/example.git 让我到达我的裸存储库。
但是,当我使用 Git Bash (MingW32) 并尝试执行以下操作时,我遇到了问题:
git clone ssh://git@myserver/var/git/example.git
我得到响应:
Cloning into example...
fatal: '/var/git/example.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
当我尝试时:
git clone ssh://git@myserver:c:/cygwin/var/git/example.git
它有效并且存储库被克隆。
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.
但是,如果我尝试使用以下命令进行推送:
cd example
git push
它会失败:
git: '/cygwin/var/git/example.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly
那么我该如何进行这项工作,以便我可以推送/拉取/克隆?理想情况下,我希望能够使用 Cygwin 路径样式,例如。 git 克隆 ssh://git@myserver/var/git/example.git 。
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
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不知道这个问题是否已经解决,但我终于成功地让它发挥作用,并在另一个线程上分享了我的答案:
https://stackoverflow。 com/a/10509588
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
我最近遇到了类似的问题,cygwin git 无法正常工作。我安装了msysgit。
然后,为了让事情正常工作,我需要从 msysgit shell 完成所有 git 工作。根据我的经验,大多数事情都在 dos shell 下工作,但推送却不行。我建议重新开始并使用 msysgit bash shell 克隆一个新的存储库,并使用该 shell 执行所有 git 命令,然后推送可能会起作用。
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.
我也遇到了这个问题,因为我正在运行 Putty、WinSCP、TortoiseSVN 和 TortoiseGIT,并且它们之间共享一个选美。
我通过将 GIT_SSH 从 Putty\plink.exe 更改为 TortoiseSVN\bin\TortoisePlink.exe 解决了这个问题
例如。
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.