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.
我在一个远程Ubuntu盒子上设置了Gitosis,在下面的命令中我将其称为linuxserver作为我的主机。我也使用Cygwin从Windows机器箱连接。
I followed the instructions according to: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
我按照以下说明进行操作: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
在我需要将gitosis-admin存储库克隆到本地计算机之前,我没有遇到任何问题
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.
当我这样做时,该命令执行,但在那里挂起显示什么,直到我ctrl-c返回到命令提示符。根本没有显示任何消息。
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.
我很确定我的ssh密钥设置正确,因为使用“ssh linuxserver”登录到我的常规帐户可以很好地工作,而无需输入密码。
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.
编辑:周末我在家里设置了一个几乎相同的Ubuntu盒子,设置Gitosis没问题。唯一的区别是我从OSX而不是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.
编辑:我也发现当使用“Git Extensions”提供的Bash Shell时,我没有问题,所以问题肯定是某种Cygwin冲突。
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.
编辑:只是一个更新,但在发布这个问题大约一个月后,我切换到Mercurial,发现我比git更喜欢它。感谢您的建议,但我不打算回到git尝试其中任何一个。
6 个解决方案
#1
I'd also recommend setting the debug option in the conf.
我还建议在conf中设置调试选项。
[gitosis]
loglevel = DEBUG
#2
Did you check /var/log/messages
on your server?
May be the username 'git' does not work properly: From the comments of Gitosis,
你检查过服务器上的/ var / log / messages了吗?可能是用户名'git'无法正常工作:来自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.
如果查看authorized_key文件,您将看到它没有导入生成密钥的系统名称,而是导入服务器框的名称。
Example: using a username of “git” resulted in this in the authorized key
示例:使用用户名“git”在授权密钥中生成此内容
root@git-repo:/home/git/.ssh# cat authorized_keys command=”gitosis-serve root@git-repo”
After changing to user name “gitosis” it looks like this
更改为用户名“gitosis”后,它看起来像这样
root@git-repo:/home/gitosis/.ssh# cat authorized_keys command=”gitosis-serve myuser@mylocalbox”,
To fix I created a user gitosis with home dir of /home/gitosis and ran the git-init script again.
为了修复我用/ home / gitosis的主目录创建了一个用户gitosis并再次运行git-init脚本。
sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/gitosis/repositories/gitosis-admin.git/hooks/post-update
then, on local box..
然后,在当地的盒子..
git clone gitosis@YOUR_SERVER_HOSTNAME:gitosis-admin.git
#3
I found these instructions provided more explanation of what you are doing when you install gitosis. Might help someone.
我发现这些说明提供了更多解释你在安装gitosis时所做的事情。可以帮助别人。
#4
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.
我遇到了和你一样的问题,我解决问题的方法是将用户“git”添加到服务器上ssh配置文件中的允许用户。一个基本的疏忽 - 是的 - 但是当我遵循相同的教程并且没有提到这一步时,很容易就会有其他人忘记将git用户添加到ssh配置文件中。
#5
I had similar problem on my computer. I installed gitosis on Archlinux and it works when running
我的电脑上有类似的问题。我在Archlinux上安装了gitosis,它在运行时运行
git clone ssh://git@localhost/oslab.git
But if I change the localhost to IP like 192.168.1.1, it hangs.
但是,如果我将localhost更改为IP,如192.168.1.1,它会挂起。
#6
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
如果其他人遇到此问题,并且尝试从也安装了Msys Git的客户端上的Cygwin环境进行连接,请检查GIT_SSH环境变量的值。它应该是未设置或等于/ usr / bin / ssh而不是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.
我能够作为git用户ssh到服务器(具有gitosis脚本的预期拒绝),但是我无法克隆。
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
我意识到发生了一些奇怪的事情,因为git仍然警告主机是未知的,而直接的ssh连接却没有。当我查看strace的输出时,这一点得到了证实
strace git clone git@server:gitosis-admin.git | less
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.
搜索sting“ssh”,显示GIT_SSH指向plink.exe - Msys Git使用的putty ssh客户端。不知道为什么plink.exe不起作用,但设置GIT_SSH = / usr / bin / ssh修复了一些问题。
#1
I'd also recommend setting the debug option in the conf.
我还建议在conf中设置调试选项。
[gitosis]
loglevel = DEBUG
#2
Did you check /var/log/messages
on your server?
May be the username 'git' does not work properly: From the comments of Gitosis,
你检查过服务器上的/ var / log / messages了吗?可能是用户名'git'无法正常工作:来自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.
如果查看authorized_key文件,您将看到它没有导入生成密钥的系统名称,而是导入服务器框的名称。
Example: using a username of “git” resulted in this in the authorized key
示例:使用用户名“git”在授权密钥中生成此内容
root@git-repo:/home/git/.ssh# cat authorized_keys command=”gitosis-serve root@git-repo”
After changing to user name “gitosis” it looks like this
更改为用户名“gitosis”后,它看起来像这样
root@git-repo:/home/gitosis/.ssh# cat authorized_keys command=”gitosis-serve myuser@mylocalbox”,
To fix I created a user gitosis with home dir of /home/gitosis and ran the git-init script again.
为了修复我用/ home / gitosis的主目录创建了一个用户gitosis并再次运行git-init脚本。
sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/gitosis/repositories/gitosis-admin.git/hooks/post-update
then, on local box..
然后,在当地的盒子..
git clone gitosis@YOUR_SERVER_HOSTNAME:gitosis-admin.git
#3
I found these instructions provided more explanation of what you are doing when you install gitosis. Might help someone.
我发现这些说明提供了更多解释你在安装gitosis时所做的事情。可以帮助别人。
#4
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.
我遇到了和你一样的问题,我解决问题的方法是将用户“git”添加到服务器上ssh配置文件中的允许用户。一个基本的疏忽 - 是的 - 但是当我遵循相同的教程并且没有提到这一步时,很容易就会有其他人忘记将git用户添加到ssh配置文件中。
#5
I had similar problem on my computer. I installed gitosis on Archlinux and it works when running
我的电脑上有类似的问题。我在Archlinux上安装了gitosis,它在运行时运行
git clone ssh://git@localhost/oslab.git
But if I change the localhost to IP like 192.168.1.1, it hangs.
但是,如果我将localhost更改为IP,如192.168.1.1,它会挂起。
#6
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
如果其他人遇到此问题,并且尝试从也安装了Msys Git的客户端上的Cygwin环境进行连接,请检查GIT_SSH环境变量的值。它应该是未设置或等于/ usr / bin / ssh而不是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.
我能够作为git用户ssh到服务器(具有gitosis脚本的预期拒绝),但是我无法克隆。
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
我意识到发生了一些奇怪的事情,因为git仍然警告主机是未知的,而直接的ssh连接却没有。当我查看strace的输出时,这一点得到了证实
strace git clone git@server:gitosis-admin.git | less
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.
搜索sting“ssh”,显示GIT_SSH指向plink.exe - Msys Git使用的putty ssh客户端。不知道为什么plink.exe不起作用,但设置GIT_SSH = / usr / bin / ssh修复了一些问题。