also sprach Richard Hartmann <> [2011.04.02.2203 
> Can someone dump a current snippet that will create a fake bare
> git repo that works locally _and_ allows me to push to a truly
> bare remote?

The concept of "fake bare git" comes from the fact that the GIT_DIR
is names e.g. vim.git (instead of .git), which is like a bare repo,
but core.bare is set to false (hence "fake"), because there is
a worktree, albeit it's detached.

I think "detached worktree repository" also covers it and might be
a better name.

Here is how to create one:

Create a *non-bare* repo as you would always do, but in a temp
directory (or directly in ~ if you wish):

  mkdir mytempworktree && cd mytempworktree
  git init
  git remote add origin ssh://server/path/to/repo
  git config branch.master.remote origin
  git config branch.master.merge refs/heads/master

Or if the repo already exists remotely, clone it into a temp
directory (or ~):

  mkdir mytempworktree && cd mytempworktree
  git clone git://

Then move the GIT_DIR to the final location and set core.worktree
to point to the worktree (~ in our case)

  git config core.worktree ../../     # ~/.fgits/vim.git/../../ → ~
  mv .git ~/.fgits/vim.git

and possibly move checked out files to the worktree:

  mv * .* ~

To work with the repo, make sure to export


    alias git="git --work-tree=$HOME --git-dir=$HOME/.fgits/repo.git")

Essentially, this is what my vcsh function does for me:

martin | |
"glaube heißt nicht wissen wollen, was wahr ist."
                                                 - friedrich nietzsche

Attachment: digital_signature_gpg.asc
Description: Digital signature (see

vcs-home mailing list

Reply via email to