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

git init respecting GIT_WORK_DIR

From
TRTony Risinger <sweetsinsemilla@gmail.com>
Date
Dec 9, 2009, 18:37 UTC
Message-ID
<96aa03fc0912091037o6b253f81u41fb660c1f8bf908@mail.gmail.com>
should this be expected behavior?
-----DOC
       core.bare
           (snipped)
           This setting is automatically guessed by git-clone(1) or
git-init(1) when the repository was created. 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).
-----PROBLEM
[cr@extOFme-d0 ~]$ export GIT_DIR=gitdir.git GIT_WORK_DIR=workdir.work

[cr@extOFme-d0 ~]$ git init Initialized empty Git repository in /home/cr/gitdir.git/

[cr@extOFme-d0 ~]$ git config core.bare true

[cr@extOFme-d0 ~]$ git config core.worktree [cr@extOFme-d0 ~]$

-----SUMMARY

i think git should not be so restrictive in what it considers to be a bare repository. when you use --work-tree:

[cr@extOFme-d0 ~]$ export GIT_DIR=gitdir.git GIT_WORK_DIR=workdir.work

[cr@extOFme-d0 ~]$ git --work-tree="$GIT_WORK_DIR" init Initialized empty Git repository in /home/cr/gitdir.git/

[cr@extOFme-d0 ~]$ git config core.bare false

[cr@extOFme-d0 ~]$ git config core.worktree /home/cr/workdir.work

everything works as expected. "git init" should respect GIT_WORK_DIR env variable and set core.bare and core.worktree appropriately.

Message 1 of 1 in “git init respecting GIT_WORK_DIR”
  1. Tony RisingerDec 9, 2009

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.