1

I'm confused how to use subgit if I want my Git repository to have a .git subdirectory.

If I use the conventional subgit configure + (subgit import or subgit install), it doesn't create a .git directory.

If I do git init first, then I can do subgit import but it won't seem to let me do subgit configure first, and I want to setup my configuration file so I don't have to put a bunch of stuff in the command-line for subgit import.

Is there a way to tell subgit to use the conventional .git directory for all the repository stuff?

Jason S
  • 184,598
  • 164
  • 608
  • 970
  • 1
    Aren't you confusing bare and not bare repositories (see a short [article](http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/) on them)? Usually you create a bare repository with `git init --bare` command, then run `subgit configure` + `subgit install` on it (`subgit import` is just a shortcut for configure + install + uninstall). Then you clone the resulting repository with `git clone` to get a non-bare repository with working tree and `.git/` directory in it. So you mostly work with that non-bare repository. If this is not a solution, please describe where Git objects are stored. – Dmitry Pavlenko Mar 23 '15 at 21:08
  • ah, ok, thanks -- I'll read up on them. – Jason S Mar 23 '15 at 23:59
  • Yeah, I just tried it with `git init --bare` instead of `git init` and it worked now. Could you post this as an answer? I'll accept. – Jason S Mar 24 '15 at 00:00

1 Answers1

3

You should always install SubGit into a bare repository. To create a bare repository use git init --bare command. Alternatively you can specify non-existing or empty directory to subgit configure command and SubGit will create a bare Git repository at it:

$ subgit configure --svn-url <SVN_URL> non-existing-directory.git
$ subgit install non-existing-directory.git

Then you should setup Apache or SSH to give access to this repository or clone it locally to get a repository with .git/ directory and working tree.

I would also note that subgit import is mostly a shortcut to subgit configure + subgit install + subgit uninstall commands, so for just one-time import you can use

$ subgit import --svn-url <SVN_URL> non-existing-directory.git
Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38
  • Very helpful as I did not find mention of the clone step in the SubGit documentation. – oli Nov 19 '15 at 15:37