git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Problems setting up bare repository (git 1.5.3.3)

From
Barry Fishman <barry_fishman@acm.org>
Date
Oct 2, 2007, 13:54 UTC
Message-ID
<m34ph9tye1.fsf@barry_fishman.acm.org>
In-Reply-To
<Pine.LNX.4.64.0710021045430.28395@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> 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
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 9 of 18 in “Problems setting up bare repository (git 1.5.3.3)”
  1. Barry FishmanOct 1, 2007
  2. Junio C HamanoOct 1, 2007
  3. Carl WorthOct 1, 2007
  4. J. Bruce FieldsOct 1, 2007
  5. Junio C HamanoOct 1, 2007
  6. Carl WorthOct 1, 2007
  7. Shawn O. PearceOct 1, 2007
  8. Johannes SchindelinOct 2, 2007
  9. Barry FishmanOct 2, 2007
  10. Johannes SchindelinOct 2, 2007
  11. Barry FishmanOct 2, 2007
  12. Carl WorthOct 2, 2007
  13. Johannes SchindelinOct 2, 2007
  14. Junio C HamanoOct 2, 2007
  15. SeanOct 2, 2007
  16. Junio C HamanoOct 2, 2007
  17. Johannes SchindelinOct 2, 2007
  18. Johannes SchindelinOct 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.