Subject: Re: Problems setting up bare repository (git 1.5.3.3)

From: Barry Fishman <[email-masked]>
Date: Tue, 02 Oct 2007 09:54:46 -0400

Johannes Schindelin <[email-masked]> writes:
> Well, if the OP had used "git push <bla> master" instead of 
> "... master:master", it would have worked.  I am unaware of any tutorial 
> that suggests the latter, only of tutorials that suggest the former.

I did recheck the tutorials, and did not find the code I was
using.  So there was nothing incorrect in the documentation.

As for "master working where "master:master" didn't, this only exposes a
more complex set of rules.  I was not hoping for a more complex set of
rules to learn, as GIT tried to figure out what I meant.  I was hoping
for a simpler command that did what I told it to do, and I was given it
by Junio Hamano.

What distracted me was that after the "git --bare init", there seemed to
be a incompletely defined setup.  This sent me down the wrong path.

Although there was a master branch to which HEAD pointed, there was no
ref/heads/master file or even a "packed-refs".  This also confuses the
the "git branch" command, so that when I initial tried "git --bare
branch" it seemed unaware of any master branch.  I then tried:

$ git --bare branch refs/heads/master
fatal: Not a valid object name: 'master'.

If there isn't an initial master branch, then shouldn't "git branch" be
able to create one.  And if there is one, shouldn't the automatic rules
explained in git-rev-parse man page find it?  The error messages from
the branch command is what got me on the wrong logical path.

The man page for git-init says:

  This command creates an empty git repository - basically a .git directory
  with subdirectories for objects, refs/heads, refs/tags, and template
  files. An initial HEAD file that references the HEAD of the master branch
  is also created.

Which is true, but although there is a HEAD that references the
master branch, there isn't really any master branch.  It might
say something like:

  This command creates an empty git repository - basically a .git directory
  with subdirectories for objects, refs/heads, refs/tags, and template
  files. An initial HEAD file references the refs/heads/master branch
  which is created with the first commit.

This would at least somewhat explain "git branch" results.

The man page for git-push seems clear to me now.  I should have
more closely read the last example.  The first example might
be changed to say:

git push origin master
    Find a ref that matches master in the source repository (most
    likely, it would find refs/heads/master), and update (or create) the
    same ref, refs/heads/master, in the origin repository with it.

-- 
Barry Fishman