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

Re: Question - .git subdirectories

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 31, 2019, 20:20 UTC
Message-ID
<20191031202015.u5l3wzvn64zypnad@camp.crustytoothpaste.net>
In-Reply-To
<CABf25VhaqrbtRTpL5ZNRy59o4JSsiKpF3pk3+54sDCkvzdgAmw@mail.gmail.com>
On 2019-10-29 at 12:26:23, Arkadij Chistyj wrote:
Show 12 quoted lines
> Hello. I'm not sure it's correctly to write to this email address.
> Sorry if it doesn't.
> Copy of my home directory stores on external disk under git control. I
> have devel/ directory that contains some of my old projects with git
> repositories. But main git repository in root of disk is not tracking
> and storing their contents. I don't want to use submodules or crutches
> such as renaming all .git/ in subdirectories. I just want that git
> treats my .git/ subdirs as plain dirs with any other names.
> It was already described here:
> https://stackoverflow.com/questions/2317652/nested-git-repositories-without-submodules.
> It's very simple functionality but I can't find any simple and right solution.
> I just want to know is this possible or not? If not possible, then why?

This is not possible. You can't add a non-bare repository as a part of a parent repository without using submodules. Git uses the .git directory to find the working tree and for safety reasons doesn't allow files or directories named that to be checked in. Allowing users to check in .git directories would allow configuration and hooks to be stored as part of the repository, which would allow the execution of arbitrary code if someone cloned it and then changed into the subrepository.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Arkadij ChistyjNext: Jonathan Nieder
Message 2 of 4 in “Question - .git subdirectories”
  1. Arkadij ChistyjOct 29, 2019
  2. brian m. carlsonOct 31, 2019
  3. Jonathan NiederOct 31, 2019
  4. Arkadij ChistyjNov 2, 2019

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.