views:

90

answers:

2

Is it possible to clone a repository without git creating a .git folder inside the local copy of the repository? Sort of like a read only functionality?

+5  A: 

You’re looking for git archive. You either use it within a repository, or pass it the --remote=<URL> switch, and it gives you a tarball or zip file of the source tree. You can pipe that straight back into tar if you want to just get a pristine copy of the tree.

Aristotle Pagaltzis
`git archive` can also create archives from remote repository. See the `--remote` option.
lunaryorn
@lunaryorn: Sounds like you have the real answer - if you posted it, I'd certainly upvote it.
Jefromi
@lunaryorn: That must have gotten added while I wasn’t looking. Thanks for the pointer. I’ve updated my answer.
Aristotle Pagaltzis
+1  A: 

It isn't, to the best of my knowledge.

You can git clone and then remove .git, but that will not be a git repository anymore -- just ordinary directory.

Also if you have access to original repository you can use git archive there to create tarball with contents of some specific commit.

Roman Cheplyaka