当使用gitos-admin时
git clone ssh://gitosis@192.168.1.1:gitosis-admin.git
我无法连接,因为ssh正在连接到端口22,而我的ssh正在2211上运行。因此,我在互联网上搜索了一个解决方案。这应该和将端口添加到我的.ssh/config文件一样简单。我将以下代码添加到文件中(我想创建该文件)
Host bml
HostName 192.168.1.1
Port 2211执行时:
git clone ssh://gitosis@bml:gitosis-admin.git
我得到以下错误:
Cloning into 'gitosis-admin'... ssh: connect to host port 22: Bad file number fatal: The remote end hung up unexpectedly
这表明我的配置文件无效或我的配置文件未被使用。
所以..。我在一个不存在的主机上测试了它
git clone ssh://gitosis@bmlsomething:gitosis-admin.git
这导致了与前面相同的错误。
Cloning into 'gitosis-admin'... ssh: connect to host port 22: Bad file number fatal: The remote end hung up unexpectedly
这表明配置文件没有被使用(okey可能仍然是一个无效的文件,但至少会出现不同的错误)。
我该如何解决这个问题呢?顺便说一句,我使用的是Windows 7 :-s。
发布于 2012-02-17 22:03:28
根据this的说法,git clone ssh://user@host:port/repository应该可以工作。
据我所知,Windows没有使用~/.ssh/config。
编辑:这个问题也在here中讨论过。
https://stackoverflow.com/questions/9329525
复制相似问题