【发布时间】:2012-02-13 15:46:20
【问题描述】:
为了解决我遇到的问题:managing website on windows using git,我在 Windows 2008 服务器上安装了 Cygwin openssh 和 Git for Windows (msysgit)(我们称之为 myserver)。
我在 cygwin 路径 /var/git/example.git 有一个裸 git repo 设置,它映射到 Windows 上的 c:\cygwin\var\git\example.git。
我有一个用户 git 对 repo 的文件夹具有权限。
我可以使用基于密钥的身份验证从我的 XP 工作站使用 Putty 使用 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
它可以工作,并且 repo 被克隆。
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 clone ssh://git@myserver/var/git/example.git.
【问题讨论】:
-
你有没有尝试过其他路径,比如
/cygdrive/c/cygwin/var/git/example.git -
是的,我试过了,但没有用。
-
是不是因为您尝试使用不属于 cygwin 的 git (msysgit)?如stackoverflow.com/a/5875642/6309 ?虽然你可以先试试stackoverflow.com/a/2745562/6309:
git config --global remote.origin.receivepack "git receive-pack"