所以,我关注了 this tutorial 安装 gitolite 服务器。
但是我的客户端机器是 Windows 机器,而不是 Linux 机器。
因此,我没有使用 ssh-keygen
,而是使用了 Eclipse“ssh2
”实用程序(在 Windows、首选项、常规、网络连接、ssh2
中) .
我生成了 .pub
文件并用于设置 gitolite(就像在教程中一样)。
但它似乎不起作用,当我尝试使用此 URL 从 Windows 连接到我的服务器时,我总是收到“Connection refused: connect
”:
ssh://gitolite@192.168.0.193:22/gitolite-admin
我打开 Eclipse 生成的 .pub
文件,我觉得有趣的是最后总是有 2 个等号。
例如,这是一个生成的公钥:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCQbDy+Nfoq+AitTrAbxy0PwRuBmgnm/vJk27KNOB3EzsZFKQ7+89I12nbxc8N+7z4Seq9fhNrYHfM7PvzgdI8F5QLxWbl2QV0UapBpjWmX+7WEE9bjEHIf7re3FpRzVdJrCAwscaUawmsIGi1rvw8ZFrbfPdS6ITiI10WcfTEdCw== RSA-1024
- 是否可以在不重新安装 gitolite 的情况下尝试另一个 key 对?
- 我可以在我的 linux 机器上生成 key 对,然后只上传在我的 Windows 机器上生成的私钥吗?
- 任何其他关于如何诊断问题的帮助都会很棒。
更新#1:
我发现我的服务器上没有运行 ssh 服务器。你可以看到:
sudo nmap -sS xxx.xxx.xxx.xxx -p 22
如果端口的状态是关闭的,那么你的 SSH 服务要么关闭要么不存在。 您也可以尝试在您的 Linux 机器上使用 SSH 连接 Putty(在 Windows 上),您将看到 SSH 服务器是否正常工作。
如果您的 SSH 服务未启动,您可以使用以下命令启动该服务: sudo 服务 ssh 启动
如果该服务不存在,您将需要安装一个 ssh 服务器。我像这样安装了我的(在 Ubuntu 上): sudo apt-get purge openssh-server sudo apt-get install openssh-server
安装 openssh 后,我的盒子上一切正常。
最佳答案
首先,如果你安装了 msysgit,你完全可以使用 ssh-keygen
(包含在这个 msysgit 模块中)。
official help page for installing gitolite也可以提供帮助。
不用担心公钥末尾的两个==
。这是正常的,这两个 ==
后面的内容总是被忽略(例如,如果需要,您可以在此处发表评论以记住该公钥的用途)。
现在:
是否可以在不重新安装 gitolite 的情况下尝试另一个 key 对?
.
是的。参见“lost admin key/access”:- Make yourself a new keypair and copy the public key to the server as '
alice.pub
'. - Log on to the server, and run
gitolite setup -pk alice.pub
. .
That's it; the new alice.pub file replaces whatever existed in the repo before.
- Make yourself a new keypair and copy the public key to the server as '
我可以在我的 linux 机器上生成 key 对,然后只上传在我的 Windows 机器上生成的私钥吗?
.
不,您的%HOME%/.ssh
文件夹中需要私钥和公钥(这意味着您必须有HOME
environment variable defined on Windows )
然后我会推荐 an%HOME%/.ssh/config
file to use your keys .任何其他关于如何诊断问题的帮助都将非常有用。
.
official doc has many tips .
我有一个 few ssh debugging tips as well .
关于linux - 从 Windows 和 Eclipse 连接到 gitolite 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19239289/