Home » Questions » Computers [ Ask a new question ]

Git Syntax: How to archive a repository?

Git Syntax: How to archive a repository?

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.

Asked by: Guest | Views: 247
Total answers/comments: 2
Guest [Entry]

"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."
Guest [Entry]

"Archive the last commit of your repo and getting rid of everything else (.git etc etc):

git archive --format=tar.gz HEAD > file.tar.gz"