设置 Gitosis,但无法克隆
我已经在远程 Ubuntu 机器上设置了 Gitosis,在以下命令中我将其称为 linuxserver 作为我的主机。 我还使用 Cygwin 从 Windows 盒子进行连接。
我按照以下说明进行操作: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
在我需要克隆 gitosis-admin 之前我没有遇到任何问题 当我执行此操作时,命令会执行,但会挂在那里,
git clone git@linuxserver:gitosis-admin.git
不显示任何内容,直到我按 ctrl-c 返回命令提示符为止。 根本不显示任何消息。
我很确定我的 ssh 密钥设置正确,因为使用“ssh linuxserver”登录我的常规帐户可以完美地工作,无需输入密码。
编辑:周末我在家里设置了一个几乎相同的 Ubuntu 盒子,并且设置 Gitosis 没有任何问题。 唯一的区别是我是从 OSX 而不是 Cygwin 连接的。
编辑:我还发现,当使用“Git Extensions”提供的 Bash Shell 时,我没有任何问题,所以问题肯定是某种 Cygwin 冲突。
编辑:只是一个更新,但在发布这个问题大约一个月后,我切换到 Mercurial,发现我比 git 更喜欢它。 感谢您的建议,但我不打算返回 git 来尝试其中的任何建议。
I've set up Gitosis on a remote Ubuntu box which I will refer to as linuxserver as my host in the following commands. I'm also connecting from a Windows box using Cygwin.
I followed the instructions according to: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
I had no problems up until I needed to clone the gitosis-admin repository to my local machine
git clone git@linuxserver:gitosis-admin.git
When I do this, the command executes, but hangs there displaying nothing until I ctrl-c to get back to a command prompt. No messages are displayed at all.
I'm pretty sure I have my ssh keys set up properly, because logging in using "ssh linuxserver" into my regular account works perfectly without asking for a password.
Edit: Over the weekend I set up a near identical Ubuntu box at home, and had no problem setting up Gitosis. The only difference was that I was connecting from OSX instead of Cygwin.
Edit: I've also discovered that when using the Bash Shell provided with "Git Extensions", I have no problems, so the issue definitely seems to be some kind of Cygwin conflict.
Edit: Just an update, but about a month after posting this question, I switched to Mercurial, and found that I prefer it much more than git. Thanks for the suggestions, but I don't plan on going back to git to try any of them out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我还建议在conf.d文件中设置调试选项。
I'd also recommend setting the debug option in the conf.
您检查过服务器上的
/var/log/messages
吗?可能是用户名“git”无法正常工作:来自 Gitosis 的注释,
如果你查看authorized_key 文件,你会发现它没有导入生成密钥的系统的名称,而是导入了服务器框的名称。
示例:使用用户名“git”导致授权密钥中出现此情况
更改为用户名“gitosis”后,它看起来像这样
要解决此问题,我创建了一个用户 gitosis,其主目录为 /home/gitosis 并运行了 git-init 脚本再次。
然后,在本地盒子上..
Did you check
/var/log/messages
on your server?May be the username 'git' does not work properly: From the comments of Gitosis,
if you look at the authorized_key file you will see that it did not import the name of the system that key was generated on but the name of the server box.
Example: using a username of “git” resulted in this in the authorized key
After changing to user name “gitosis” it looks like this
To fix I created a user gitosis with home dir of /home/gitosis and ran the git-init script again.
then, on local box..
我发现这些说明提供了有关安装 gitosis 时所做操作的更多说明。 可能会帮助某人。
I found these instructions provided more explanation of what you are doing when you install gitosis. Might help someone.
我遇到了和你一样的问题,我的解决方案是将用户“git”添加到服务器上 ssh 配置文件中允许的用户中。 一个基本的疏忽 - 是的 - 但当我遵循相同的教程并且没有提到此步骤时,其他人很容易忘记将 git 用户添加到 ssh 配置文件中。
I had the same problem as you and my solution to the problem was to add the user "git" to the allowed users in the ssh config file on the server. A basic oversight - yes - but as I followed the same tutorial and this step is not mentioned it could easily be that other people forgot about adding the git user to the ssh config file.
我的电脑上也有类似的问题。 我在 Archlinux 上安装了 gitosis,它在运行时可以工作,
但是如果我将 localhost 更改为 IP(如 192.168.1.1),它就会挂起。
I had similar problem on my computer. I installed gitosis on Archlinux and it works when running
But if I change the localhost to IP like 192.168.1.1, it hangs.
如果其他人遇到此问题,并且尝试从也安装了 Msys Git 的客户端上的 Cygwin 环境进行连接,请检查 GIT_SSH 环境变量的值。 它应该未设置或等于 /usr/bin/ssh 而不是 plink.exe
我能够以 git 用户身份 ssh 到服务器(预期会被 gitosis 脚本拒绝),但是我无法克隆。
我意识到发生了一些奇怪的事情,因为 git 仍然警告主机未知,而直接 ssh 连接却没有。 当我查看 strace 的输出
并搜索字符串“ssh”时,这得到了证实,显示 GIT_SSH 指向 plink.exe - Msys Git 使用的 putty ssh 客户端。 不知道为什么 plink.exe 不起作用,但设置 GIT_SSH=/usr/bin/ssh 修复了问题。
If anyone else has had this problem, and was trying to connect from a Cygwin environment on a client that also had Msys Git installed, check the value of the GIT_SSH environment variable. It should be unset or equal to /usr/bin/ssh not plink.exe
I was able to ssh to the server as the git user (with the expected rejection from the gitosis scripts), however I was unable to clone.
I realised something strange was happening because git was still warning that the host was unknown whereas a direct ssh connection did not. This was confirmed when I looked in to the output from strace
Searching for the sting "ssh", showed that GIT_SSH pointed to plink.exe - the putty ssh client used by Msys Git. Not sure why plink.exe didn't work, but setting GIT_SSH=/usr/bin/ssh fixed things.