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

Re: Need to set GIT_WORK_TREE when setting GIT_DIR !?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 10, 2012, 14:11 UTC
Message-ID
<20120310141119.GA11178@burratino>
In-Reply-To
<CALeToSUaPzdr=u7FfwHEtEanphVP5LZ09QdQXno52PLBTK0H-g@mail.gmail.com>
Hi,
Frédéric Heitzmann wrote:
> export GIT_DIR=$PWD/.gita &&
> git init

This is where the recipe goes wrong. It creates a bare repository. Using vi or "git config" to edit its configuration to set the "[core] bare" setting to false would change that.

The git-config(1) manpage says:
	By default a repository that ends in "/.git" is assumed to be
	not bare (bare = false), while all other repositories are
	assumed to be bare (bare = true).
and the logic in builtin/init-db.c seems to agree.

Maybe there is a better place to document this. Improvements welcome.

Thanks, Jonathan

Previous: Junio C HamanoNext: Frédéric Heitzmann
Message 6 of 7 in “Need to set GIT_WORK_TREE when setting GIT_DIR !?”
  1. Frédéric HeitzmannMar 9, 2012
  2. Junio C HamanoMar 9, 2012
  3. Frédéric HeitzmannMar 10, 2012
  4. Nguyen Thai Ngoc DuyMar 10, 2012
  5. Junio C HamanoMar 10, 2012
  6. Jonathan NiederMar 10, 2012
  7. Frédéric HeitzmannMar 11, 2012

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.