Re: cant get git to work over http

Previous thread: git push [rejected] question by Jason Garber on Monday, February 18, 2008 - 3:15 pm. (18 messages)

Next thread: [PATCH] branch: optionally setup branch.*.merge from upstream local branches by Jay Soffian on Monday, February 18, 2008 - 7:07 pm. (14 messages)
From: Anatoly Yakovenko
Date: Monday, February 18, 2008 - 5:49 pm

so this is as fun as pulling teeth

i have been following this guide,
http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt

but no matter what i do, when i try to do the initial push, git just
hangs without any messages.  I have nothing in my apache server error
log, but i have this in the accesslog:

*.*.*.*- foobar [18/Feb/2008:16:40:12 -0800] "PROPFIND /git/repo
HTTP/1.1" 301 320

is there any way to get more verbose output out of git?
-

From: Mike Hommey
Date: Monday, February 18, 2008 - 11:39 pm

Try adding a / at the end of the url you use for your repo.

Mike
-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 12:09 am

ah cool, that was it.  The initial push seems to have worked,

$ git push -v upload master
Pushing to http://aeyakovenko@myserver.com/git/repo/
Getting pack list
Fetching remote heads...
  refs/
  refs/tags/
  refs/heads/
'refs/heads/master': up-to-date


but i cant clone or just normally push and pull the repo.

$ git-pull
fatal: 'origin': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly

and

$ git-clone http://aeyakovenko@myserver.com/git/repo/ foobar
Initialized empty Git repository in /home/aeyakovenko/projects/foobar/.git/
cat: /home/aeyakovenko/projects/foobar/.git/refs/remotes/origin/master:
No such file or directory
/usr/bin/git-clone: line 450: cd:
/home/aeyakovenko/projects/foobar/.git/refs/remotes/origin: No such
file or directory
fatal: : not a valid SHA1
fatal: Not a valid object name HEAD
-

From: Mike Hommey
Date: Tuesday, February 19, 2008 - 2:39 am

Try again with the GIT_CURL_VERBOSE variable set to 1 and try to see

The error message is strange... Anyways, you might want to run this command
under sh -x (i.e. sh -x $(which git-clone) http://aeyakovenko@myserver.com/git/repo/ foobar)
What version of git are you using ?

Mike
-

From: Johannes Schindelin
Date: Tuesday, February 19, 2008 - 4:18 am

Hi,



Since you did not clone from anywhere, the remote "origin" is not set.  
You will have to do that yourself:


That smells like another "master"-less repository.  Why do people do that?  
Isn't it just _easier_ and more _hassle-free_ to just accept that the 
initial branch is called "master"?

Hth,
Dscho

-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 11:19 am

Thanks, that worked.  but push still gives me an error:

$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either.  Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

    branch.master.remote = <nickname>
    branch.master.merge = <remote-ref>
    remote.<nickname>.url = <url>
    remote.<nickname>.fetch = <refspec>


what do you mean by master-less?  I would love to just be able to
create a normal git repo with "git-init" and clone it over http the
same way that i do over ssh and the filesystem.  but when I do that
over http i get this error:

$ git-clone http://aeyakovenko@myserver.com/git/repo/ repo
Initialized empty Git repository in /home/aeyakovenko/projects/repo/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

and running `git-update-server-info` does nothing.
-

From: Jon Loeliger
Date: Tuesday, February 19, 2008 - 11:24 am

Did you follow this advice?  You've set up the
origin's URL now, and so it knows from where the
fetch step will happen, but have you set up the
merge step yet?  Does it know what branches to
merge on that pull request?

jdl
-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 12:06 pm

i dont understand what these values should be.
http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt
 doesn't mention anything about configuring them.  So why cant i have
git working the same way over http as it does over ssh and the
filesystem?
-

From: Johannes Schindelin
Date: Tuesday, February 19, 2008 - 12:19 pm

Hi,


You can.  But please understand that there is a difference from having 
cloned from somewhere, or setting up an uncloned repository.

You are experiencing that it is not all that easy to set up tracking 
information when your local branch is the original, and the remote was 
initialised with your local branch.

So the documentation you quoted does not help.  You are supposed to know 
enough about git details, such as where to find out what the 
branch.*.remote and branch.*.merge settings mean, before reading 
setup-git-server-over-http.txt.

Ciao,
Dscho

-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 12:27 pm

ok, so how do i set up an empty git repository over http, like i would
over ssh of the fs?
-

From: Johannes Schindelin
Date: Tuesday, February 19, 2008 - 12:41 pm

Hi,


You set up the git repsitory via http, so where is the problem?

If you don't know how to set up the tracking information, why not just 
reclone?

Alternatively, you can read up on how to set up that information in the 
user manual.

Hth,
Dscho

-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 12:53 pm

> You set up the git repsitory via http, so where is the problem?

 ok, i created a directory on my server.  Dav is on and working, i can
send and download files using IE on that url.

So is it possible for me to just simply run "git-init" in that
directory, and treat that url as i would a repo over ssh or the fs?

i can do this:

$ git-clone /var/www/localhost/htdocs/git/repo/ repo
Initialized empty Git repository in /home/aeyakovenko/projects/repo/.git/
1 block

and i can do this:

$ git-clone ssh://aeyakovenko@localhost/var/www/localhost/htdocs/git/repo/ repo
Initialized empty Git repository in /home/aeyakovenko/projects/repo/repo/.git/
aeyakovenko@localhost's password:
Receiving objects: 100% (3/3), done.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)

but for the life of me i cant do this:

$ git-clone http://aeyakovenko@localhost/var/www/localhost/htdocs/git/repo/ repo
Initialized empty Git repository in /home/aeyakovenko/projects/repo/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?
-

From: Jeff King
Date: Tuesday, February 19, 2008 - 12:57 pm

Is your webserver exporting "/"? Or should it be
"http://aeyakovenko@localhost/git/repo"? If the path is correct, did you
run git-update-server-info in the repository you are trying to clone?

-Peff
-

From: Johannes Schindelin
Date: Tuesday, February 19, 2008 - 12:57 pm

Hi,


Maybe run "git update-server-info" in that directory?

Hth,
Dscho

-

From: Jon Loeliger
Date: Tuesday, February 19, 2008 - 1:05 pm

Ponder the Doc Root for an HTTP request.  Remember that your httpd
will likely be striping or rewriting that base directory path and
so it won't be needed on your git http:// requests.

Since my repository was outside of the basic Doc Root, and I wanted
to present similar path names to both git: and http: protocols, I
ended up rewriting some URL paths.  Also, if you have some form of
virtual hosting going on, you might need to do a virtualization
rewriting using --interpolated-path=pathtemplate.

HTH,
jdl
-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 2:05 pm

so, basically i need to append a .git to the repository root?  I am
getting these http requests in the access log:

72.192.162.186 - aeyakovenko [19/Feb/2008:12:58:13 -0800] "GET
/var/www/localhost/htdocs/git/repo/info/refs HTTP/1.1" 404 313

/var/www/localhost/htdocs/git/repo/info/refs doesn't exist, although
this exists:

/var/www/localhost/htdocs/git/repo/.git/info/refs

So why doesn't the http protocol handle this?  I can access
http://localhost/git/repo/.git/info/refs  through the browser without
a problem.  Is there any way to configure http protocol to just treat
the repository the same way ssh and fs does?

Thanks,
Anatoly
-

From: Jon Loeliger
Date: Tuesday, February 19, 2008 - 2:55 pm

Something is fishy here.  Is your repository bare or not?

jdl
-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 2:59 pm

> Something is fishy here.  Is your repository bare or not?

no, why does it need to be bare?
-

From: Anatoly Yakovenko
Date: Tuesday, February 19, 2008 - 3:13 pm

so bare or not ssh works but http doesnt:

$ git-clone ssh://aeyakovenko@localhost/var/www/localhost/htdocs/git/bare
bare-ssh
Initialized empty Git repository in /home/aeyakovenko/projects/bare-ssh/.git/
Receiving objects: 100% (3/3), done.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)



and running over a bare directory doesn't work:


$ git-clone http://aeyakovenko@localhost/git/bare bare
Initialized empty Git repository in /home/aeyakovenko/projects/bare/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

apache acess log:

127.0.0.1 - - [19/Feb/2008:14:10:19 -0800] "GET /git/bare/info/refs
HTTP/1.1" 401 460

i feel like i am taking crazy pills, why is apache looking for
/git/bare/info/refs, and no the directory from the doc root?
-

From: Johannes Schindelin
Date: Tuesday, February 19, 2008 - 3:20 pm

Hi,


Having a non-bare repository on a web server does not make sense at all.  
It's not like you will be developing in there, right?

And yes, you can append "/.git/" to your URL and it should work fine.  
HTTP transport is a second class citizen, and will probably never be as 
efficient as GIT transport.

Therefore, you can choose to continue your efforts with the http:// URL, 
but are mostly on your own, or you can go with ssh (git://) and it just 
works.

Unfortunately, I do not have the time to help you more.

Ciao,
Dscho

-

From: Anton Gladkov
Date: Wednesday, February 20, 2008 - 6:46 am

-- 
Best regards,
		anton
mailto:agladkov@sw.ru
-

From: Robert Haines
Date: Wednesday, February 20, 2008 - 3:39 am

What is the document root set to on your web server? It shouldn't be  
'/'! When doing git over ssh you need the whole path, but when over  
http you just need the path from the document root...

So I would expect that your http clone should be:
$ git-clone http://aeyakovenko@localhost/git/repo/ repo

What happens when you point a web browser at either http:// 
aeyakovenko@localhost/var/www/localhost/htdocs/git/repo/ or http:// 
aeyakovenko@localhost/git/repo/ ?

Cheers,
Rob

-

Previous thread: git push [rejected] question by Jason Garber on Monday, February 18, 2008 - 3:15 pm. (18 messages)

Next thread: [PATCH] branch: optionally setup branch.*.merge from upstream local branches by Jay Soffian on Monday, February 18, 2008 - 7:07 pm. (14 messages)