So I have a git repository on my local computer that I want to archive (zip is fine) and upload to my server. Once the file has been uploaded to the server, I will extract the archive. I don't need any of the git information, so I think I need to use git archive but I'm not exactly sure how to use it...and the tutorials haven't been helping.

this is what I've got so far:

cd projectname
git archive master

Then I don't know what to do next. I want to create the archive in this directory:

./../_toDeploy/

How do I do it?

link|improve this question

65% accept rate
feedback

2 Answers

up vote 5 down vote accepted

Any one of the following will work:

git archive --output=../_toDeploy/ArchiveName.zip master
git archive -o ../_toDeploy/ArchiveName.zip master

To add a subdirectory inside the archive,

git archive --output=../_toDeploy/ArchiveName.zip --prefix=MyStuff/ master

See the git-archive manual page for reference.

link|improve this answer
is it possible to put the repository inside a directory before archiving it? – Andrew Dec 10 '09 at 3:21
Yes, use --prefix. I've added this to the answer. – Stephen Jennings Dec 10 '09 at 3:26
feedback

The following will zip up your master branch and put it in the folder you mentioned.

git archive --format=zip master > ../_toDeploy/repo.zip
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.