Re: git-clone works with ssh but not with http/https/git

Previous thread: Re: why is git destructive by default? (i suggest it not be!) by David Jeske on Tuesday, June 24, 2008 - 3:42 am. (6 messages)

Next thread: git-fetch remote tag to local branch fails by Klas Lindberg on Tuesday, June 24, 2008 - 5:17 am. (10 messages)
From: Erez Zilber
Date: Tuesday, June 24, 2008 - 4:15 am

Hi,

I'm able to git-clone a tree using ssh:

[root@kd001 t]# git-clone
ssh://erez.zilber@kites/pub/git/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
erez.zilber@kites's password:
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 9 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (9/9), done.

However, it doesn't work with http/https/git:

[root@kd001 t]# git-clone http://kites/pub/git/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

[root@kd001 t]# git-clone https://kites/pub/git/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

[root@kd001 t]# git-clone git://kites/pub/git/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
kites[0: 172.16.1.11]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
fetch-pack from 'git://kites/pub/git/erez.zilber/my_test.git' failed.

What's the problem?

Thanks,
Erez
--

From: Matthias Kestenholz
Date: Tuesday, June 24, 2008 - 4:21 am

Maybe you should run git-update-server-info in the repository on the


Maybe you should run git-update-server-info in the repository on the
server?

By the way, try enabling the post-update hook -- it runs
update-server-info for you automatically after pushing to your server

Is the git daemon running on your server? You need to configure inetd or
git-daemon yourself, that is not done automatically for you.


-- 
http://spinlock.ch/blog/

--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 4:45 am

Forgot to mention - I tried to run git-update-server-info from the
repository on the server. I got the same results. BTW - if it works OK
with ssh, I can only guess that git-update-server-info won't help for

Make it executable on the client side before pushing (i.e. in

I ran git-daemon on the server side like this:

sudo git-daemon --base-path=/pub/git/ --export-all --listen=kites

Erez
From: Johannes Schindelin
Date: Tuesday, June 24, 2008 - 4:48 am

Hi,


No, you did not.  Otherwise, the message would not appear.  It can be that 
you have _another_ repository on the server, but running 

Wrong again.  ssh transport is special, and does not need the information 
update-server-info provides.

Hth,
Dscho
--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 5:07 am

On Tue, Jun 24, 2008 at 2:48 PM, Johannes Schindelin

Thanks for the quick answer. I'm sure that something _is_ wrong.
Otherwise, everything should have worked already.

I think that I'm using the right repository for git-clone because it's
the same path that I used for git push:

[root@kd001 my_test.git]# git-push --all
ssh://erez.zilber@kites/pub/git/erez.zilber/my_test.git
erez.zilber@kites's password:
Counting objects: 9, done.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (9/9), 740 bytes, done.
Total 9 (delta 0), reused 0 (delta 0)
To ssh://erez.zilber@kites/pub/git/erez.zilber/my_test.git
 * [new branch]      master -> master

Now, on the server side:

-sh-3.1$ cd my_test.git/
-sh-3.1$ ls info/
exclude
-sh-3.1$ git-update-server-info
-sh-3.1$ ls info/
exclude  refs

looks like git-update-server-info did some work (added the refs file).

Back to the client:

[root@kd001 t]# git-clone http://kites/pub/git/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

The path is the same path that was used for pushing the repository.
What did I miss here?

Thanks,
Erez
--

From: Jakub Narebski
Date: Tuesday, June 24, 2008 - 5:25 am

First, obvious question: do you have web server enabled?

Second, less obvious: how this server maps pathname information from
URL into path in the filesystem?

-- 
Jakub Narebski
Poland
ShadeHawk on #git
--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 6:42 am

I guess that the problem is that no proper mapping exists. That's why
I see the following in /var/log/httpd/error_log:

[Tue Jun 24 16:31:52 2008] [error] [client 172.16.0.7] File does not
exist: /var/www/html/pub

What do I need to add in /etc/httpd/conf.d/ in order to set the
mapping to /pub/git instead of /var/www/html/pub ? Is there an example
that shows how to map?

Thanks,
Erez
--

From: Anton Gladkov
Date: Tuesday, June 24, 2008 - 6:54 am

IMO the simplest way is to create a symlink 'pub' in /var/www/html directory
pointing to /pub and to add 'Options FollowSymLinks' to <Directory /> in httpd.conf.

-- 
Best regards,
		Anton
mailto:agladkov@parallels.com
--

From: Anton Gladkov
Date: Tuesday, June 24, 2008 - 6:59 am

[Empty message]
From: Matthias Kestenholz
Date: Tuesday, June 24, 2008 - 7:02 am

To be able to use the HTTP git transport? No. If you use the HTTP
transport to clone a repository, gitweb is not used in any way.


-- 
http://spinlock.ch/blog/


--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 7:16 am

Adding the symlink solved the cloning with http problem.

Thanks,
Erez
--

From: Jakub Narebski
Date: Tuesday, June 24, 2008 - 11:58 am

Another solution (not necessary simplest, but it might be preferred
from the security point of view) is to do some URL rewriting / redirection.
See your web server documentation for details...

-- 
Jakub Narebski
Poland
--

From: Matthieu Moy
Date: Tuesday, June 24, 2008 - 7:05 am

Try to access the repository from a web browser first. If you don't
have directory listing enabled, opening a file like HEAD should work.

-- 
Matthieu
--

From: Johannes Sixt
Date: Tuesday, June 24, 2008 - 5:41 am

No, it's not. You pushed via ssh, but you clone via http.

When you point your web browser to

 http://kites/pub/git/erez.zilber/my_test.git

what do you see? Error 404 or a directory listing?

-- Hannes
--

From: Robert Haines
Date: Tuesday, June 24, 2008 - 5:35 am

So your clone address for git:// is wrong, you don't need the /pub/git:
git clone git://erez.zilber@kites/erez.zilber/my_test.git
As you've moved the root of the filesystem as far as git-daemon is  
concerned to /pub/git with the --base-path option. I suspect a similar  
problem for http[s] depending on how you've mapped /pub/git into your  
webserver.

rather than:
git clone ssh://erez.zilber@kites/pub/git/erez.zilber/my_test.git
for ssh which does start at the root of the filesystem.

Cheers,
Rob

--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 6:53 am

I understand. However, when I try to run it according to your suggestion:

[root@kd001 t]# git clone git://erez.zilber@kites/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
fatal: Unable to look up erez.zilber@kites (port 9418) (Name or
service not known)
fetch-pack from 'git://erez.zilber@kites/erez.zilber/my_test.git' failed.

I also tried to run it without "erez.zilber@":

[root@kd001 t]# git clone git://kites/erez.zilber/my_test.git
Initialized empty Git repository in /home/erez.zilber/work/tmp/t/my_test/.git/
kites[0: 172.16.1.11]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
fetch-pack from 'git://kites/erez.zilber/my_test.git' failed.

Is there any log file on the server that can help me trace this
problem (something like /var/log/httpd/error_log but for the git
protocol)?

Thanks,
Erez
--

From: Robert Haines
Date: Tuesday, June 24, 2008 - 7:08 am

That error is saying that the name of the service is wrong, so you're  

This looks like that either there is nothing listening (if you're  
running though xinetd have you restarted it? And have you added the  
right bits to /etc/services?) or there's a firewall in the way... git  


on my machine (running via xinetd) it goes straight into /var/log/ 
messages. A grep -i git on that file should produce something.

Cheers,
Rob

--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 7:45 am

The problem was that it listened to requests coming from the local
machine. Now (after fixing that), everything seems to work. Thanks for
the help.

BTW - I'm currently running git-daemon in the following way:

sudo git-daemon --base-path=/pub/git/ --export-all

Is there any advantage to run it through xinetd? How do you run it?

Thanks,
Erez
--

From: Daniel Barkalow
Date: Tuesday, June 24, 2008 - 10:10 am

You probably want to run it from something that init runs, or you'll have 
to figure it out again when you reboot the server in a while. So you 
either want a suitable init script (Gentoo, for example, has one in their 
git package), or to run it through xinetd (which you almost certainly have 
an init script for).

	-Daniel
*This .sig left intentionally blank*
--

From: Erez Zilber
Date: Tuesday, June 24, 2008 - 11:56 pm

Thanks. I was able to config xinetd, and everything seems to work now.
I would like to thank everyone here for the quick and very useful
help.

Erez
--

Previous thread: Re: why is git destructive by default? (i suggest it not be!) by David Jeske on Tuesday, June 24, 2008 - 3:42 am. (6 messages)

Next thread: git-fetch remote tag to local branch fails by Klas Lindberg on Tuesday, June 24, 2008 - 5:17 am. (10 messages)