问题描述
我有一个带有ssh服务器设置的windows 2003盒子。我有msysgit(git版本1.6.2)安装在本地和服务器上。
服务器具有以下我的回购站的绝对路径:
e:\vc\git\myrepo.git
当用户登录他/她时将放在以下工作目录中:
e:\vc\git\
在我的开发机器上运行以下cmd时:
git clone ssh://myuser@myip/myrepo.git testrepo
I得到以下错误:
fatal:''/myrepo.git''似乎不是git仓库
根据我的ssh日志,似乎git正在服务器上执行此cmd:
'cmd.exe / c git-upload-pack'/myrepo.git''
在本地(在服务器上)执行该命令失败的原因相同。我在想这个问题与git在路径前加'/'有关。我该如何告诉git不要这样做?注意:git-upload-pack正在工作,因为我将\gitinstallpath\libexec\\git-core添加到了路径中。显然这是一个错误,将来会被修复,这是我的工作。
我通过切换我的ssh服务器从winssh到openssh(通过cygwin层)。我能够使用winsshd连接正常(如上所述),但winsshd没有正确处理带有前缀/的路径。我可能可以让winsshd工作,但切换到cygwin和openssh更快。
以下是可以启动设置,如果你的情况类似:
I have a windows 2003 box with an ssh server setup. I have msysgit (git version 1.6.2) installed both locally and on the server.
The server has the following absolute path to my repos:
e:\vc\git\myrepo.git
when a user logs in he/she will be put in the following working directory:
e:\vc\git\
When running the following cmd on my dev machine:
git clone ssh://myuser@myip/myrepo.git testrepo
I get the following error:
fatal: ''/myrepo.git'' does not appear to be a git repository
According to my ssh logs it appears that git is executing this cmd on the server:
'cmd.exe /c git-upload-pack '/myrepo.git''
Executing that command locally (on the server) fails for the same reason. I'm thinking the problem is related to git prefixing the path with a '/'. How do I tell git not to do this? Should this be working?
Note: git-upload-pack is working because I added \gitinstallpath\libexec\git-core to the path. Apparently this is a bug and will be fixed in the future, this was my work around.
I resolved this by switching my ssh server from winssh to openssh (via the cygwin layer). I was able to connect fine (as noted above) using winsshd, but winsshd wasn't correctly handling paths prefixed with "/". I could probably get winsshd to work, but switching to cygwin and openssh was faster.
Here's a good blog post to kick start the setup if your in a similar situation:
这篇关于如何通过解决错误的路径在窗户上通过ssh阻止git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!