Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: cloning empty repo

From: Josh Triplett <hidden>
Date: 2016-06-15 22:43:18

Shawn O. Pearce wrote:
"Marijn Schouten (hkBst)" [off-list ref] wrote:
quoted
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...
You can also simulate a clone of any other repository by using a similar
series of commands; git clone exists so that you don't have to.  Why not allow
cloning an empty repository, which would give you an empty repository with the
correct origin remote?

- Josh Triplett
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help