Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 6 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.

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

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

git archive --format=zip master > ../_toDeploy/repo.zip
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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