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

Re: cloning empty repo

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 24, 2007, 23:01 UTC
Message-ID
<20070624230157.GM17393@spearce.org>
In-Reply-To
<467E8808.7030903@gentoo.org>
"Marijn Schouten (hkBst)" <hkBst@gentoo.org> wrote:
> is there any reason why cloning an empty repository should result in an error
> instead of a succesfully cloned empty repo?
There's nothing to clone.  The repository is empty.

If you create a Git repository using `git init` and then create another one also using `git init` then both repositories are empty, and an empty repository is identical to every other empty repository.

So if you want to setup an empty repository and then clone nothing, you actually can just setup another empty repository and configure the 'origin' remote:

	mkdir a; cd a; git init; cd ..
	mkdir b; cd b; git init
	# now a and b are identical
	git remote add origin ../a/.git
	# now b is a "clone" of a's nothingness...
-- 
Shawn.
Previous: Marijn Schouten (hkBst)Next: Josh Triplett
Message 2 of 3 in “cloning empty repo”
  1. Marijn Schouten (hkBst)Jun 24, 2007
  2. Shawn O. PearceJun 24, 2007
  3. Josh TriplettJun 28, 2007

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.