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

Re: pushing from a shallow repo allowed?

From
MMMikael Magnusson <mikachu@gmail.com>
Date
Feb 16, 2009, 10:00 UTC
Message-ID
<237967ef0902160200r2320687ai71e62047c3ead9ad@mail.gmail.com>
In-Reply-To
<20090212220254.GA1517@gnu.kitenet.net>
2009/2/12 Joey Hess <joey@kitenet.net>:
Show 13 quoted lines
> git-clone(1):
>        A shallow repository has a number of
>        limitations (you cannot clone or fetch from it, nor push from nor
>        into it)
>
> This and other documentation (shallow.txt, RelNotes-1.5.0.txt) says you
> can't push from a shallow repo. But in a simple test of making a commit
> to a shallow repo and pushing it out, it seems to work. AFAICS, git only
> guards against pushes *into* a shallow repo, and fetching/cloning from a
> shallow repository.
>
> Are the docs out of date, or is there really still some problem
> with pushing from a shallow repo?
AFAIK, it will work in simple cases, but isn't guaranteed to work.
Show 12 quoted lines
> BTW, --depth seems to be ignored when making a local clone.
> This seems to have been fixed in the old shell git-clone in
> d4110a9726c7cd5cda35b7dd03dc8f85fe3dff0c, was it accidentially lost
> in the C version?
>
> joey@gnu:~/src/other> git clone --depth 2 git git.shallow
> Initialized empty Git repository in /home/joey/src/other/git.shallow/.git/
> joey@gnu:~/src/other> cd git.shallow
> joey@gnu:~/src/other/git.shallow> git-log --pretty=oneline|wc -l
> 17009
>
> git version 1.5.6.5

You most likely need to use the file:// syntax for this to work, otherwise git will just hardlink/copy the whole objects dir without looking at it.

-- 
Mikael Magnusson
Previous: Joey HessNext: Adeodato Simó
Message 2 of 11 in “pushing from a shallow repo allowed?”
  1. Joey HessFeb 12, 2009
  2. Mikael MagnussonFeb 16, 2009
  3. git-clone.txt: document that pushing from a shallow clone may workAdeodato Simó, Mar 3, 2009
  4. Johannes SixtMar 3, 2009
  5. Adeodato SimóMar 3, 2009
  6. Jay SoffianMar 3, 2009
  7. Adeodato SimóMar 4, 2009
  8. Junio C HamanoMar 4, 2009
  9. Johannes SchindelinMar 4, 2009
  10. Junio C HamanoMar 5, 2009
  11. Adeodato SimóMar 4, 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.