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

local clone and submodules

From
Jack Nagel <jacknagel@gmail.com>
Date
Dec 10, 2014, 20:36 UTC
Message-ID
<CAMYxyaV3dvHFQJ1vfmZy7Hv=XHtSCSbi6s7FWdrUzdmyKWvntA@mail.gmail.com>

Say I have a local repository with several submodules that point at remote repositories. All submodules are up-to-date.

I want to clone everything to another location on disk, *without hitting the network to fetch the submodules*. Obviously a simple "git clone" will work for the superproject, but submodules will be re-fetched from the remote if I pass --recurse-submodules.

Is there any way to do this offline? Reading through the documentation, it doesn't seem easy, but perhaps it is possible to do by recursing through the submodules manually.

In Homebrew, we allow building packages directly from a project's source repository. Currently, the repositories are downloaded into a local cache, then checked out into a build directory using "git checkout-index" and "git submodule foreach". However, some projects require access to the git repository to do things like compute a version string.

We experimented with using GIT_DIR, but sometimes we are operating on multiple git repositories, and saving and restoring its value in the right places is tedious and error prone.

Our current solution is to symlink the .git directory into the build directory, but I'd like to replace this manual checkout + symlink with something cleaner. I could just copy the entire repository from the cache into the build directory, but we deal with some fairly large repositories so I would prefer to be able to use "git clone" or "git clone --shared".

Thanks for any suggestions, Jack

Message 1 of 1 in “local clone and submodules”
  1. Jack NagelDec 10, 2014

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.