15 Mar 2009, 03:33
Nachbar_pragsmall

James Nachbar (1 post)

Unfortunately, bare repositories don’t appear to be mentioned in the book, although one of the earlier posts indicates that the .git extension used for the repositories in the book is for bare repositories. A bare repository is one that does not have a working tree, and is created with:

git --bare init

Bare repositories are especially important for the common case of a remote repository used only as a push and pull source (i.e., not used directly for editing). The problem with using a regular repository, created with “git init” as described in the book, is that remote push and pull do affect with the working tree, and indeed, I get a warning every time I try to push to a repository created with “git init”.

I generally avoid this by using a bare repository for my remote. However, in migrating from svn, the “git svn clone” appears to always create a working tree.

I could not get the git svn clone example in the book to work for me. I had to name the specific branch I wanted, as in:

git svn clone svn+ssh://localhost/home/svn-repos/hvac/trunk

That imports the trunk branch of the hvac project of the svn repository in svn-repos, and creates a git repository in the “trunk” subdirectory, and checks out HEAD. Then, I can create a new bare repository from the non-bare one with

git clone --bare trunk hvac.git

After checking that everything went well, I delete the “trunk” repository, and can use the bare hvac.git repository as the base remote.

Hopefully, that will be helpful to anyone else having the same problem

James Nachbar
http://www.plastic.org

14 Apr 2009, 02:59
Generic-user-small

Steve Rowley (1 post)

The book’s total lack of treatment of this basic workflow (work on local machine, push to bare repository, pull into deployment machine) created a huge mess for me. After going through all kinds of pain to figure out what these errors meant, and why pushing to a remote repository that was supposed to house my deployed code didn’t just work, I found the link below:

http://cakebaker.42dh.com/2009/03/08/a-git-work…

which describes it quite nicely. Why you’d publish an intro to Git book that included the word “remote” without explaining this critical, initially counterintuitive process is beyond me – a big, disappointing omission.

04 May 2009, 00:06
Generic-user-small

Andrew Grimm (10 posts)

I also was surprised at the lack of bare repositories. I guess some people really need them, and some people don’t (eg people using a single computer, in big shops, or using github), and it’s easy to forget something if you don’t need it.

  You must be logged in to comment