如何通过 Windows 上的 ssh 阻止 git 解决错误的路径? [英] How to stop git via ssh on windows from resolving the wrong path?

查看:26
本文介绍了如何通过 Windows 上的 ssh 阻止 git 解决错误的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 ssh 服务器设置的 Windows 2003 机器.我在本地和服务器上都安装了 msysgit(git 版本 1.6.2).

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:vcgitmyrepo.git

当用户登录时,他/她将被放置在以下工作目录中:

when a user logs in he/she will be put in the following working directory:

e:vcgit

在我的开发机器上运行以下 cmd 时:

When running the following cmd on my dev machine:

git clone ssh://myuser@myip/myrepo.git testrepo

我收到以下错误:

fatal: ''/myrepo.git'' does not appear to be a git repository

根据我的 ssh 日志,git 似乎正在服务器上执行此 cmd:

According to my ssh logs it appears that git is executing this cmd on the server:

'cmd.exe /c git-upload-pack '/myrepo.git''

由于同样的原因,在本地(在服务器上)执行该命令失败.我认为问题与 git 在路径前加上/"有关.我如何告诉 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?

注意:git-upload-pack 正在工作,因为我将 gitinstallpathlibexecgit-core 添加到路径中.显然这是一个错误,将来会修复,这是我的工作.

Note: git-upload-pack is working because I added gitinstallpathlibexecgit-core to the path. Apparently this is a bug and will be fixed in the future, this was my work around.

推荐答案

我通过将 ssh 服务器从 winssh 切换到 openssh(通过 cygwin 层)解决了这个问题.我能够使用 winsshd 正常连接(如上所述),但是 winsshd 没有正确处理以/"为前缀的路径.我可能可以让 winsshd 工作,但切换到 cygwin 和 openssh 会更快.

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:

这篇关于如何通过 Windows 上的 ssh 阻止 git 解决错误的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆