Skip to content

Instantly share code, notes, and snippets.

@rohmann
Created August 24, 2013 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohmann/6326294 to your computer and use it in GitHub Desktop.
Save rohmann/6326294 to your computer and use it in GitHub Desktop.
Clones repository and creates zip file. (repo-name-master.zip)
#!/bin/bash
# Usage: $ ./gitarchivemaster.sh http://url/to/repo.git dest-folder
url=$1
name=$2
#Clone repo (delete existing)
rm -fR ${name}
git clone ${url} ${name}
#Delete old copy
rm -f ${name}-master.zip
#pack up the zip file
cd ${name}
git archive --format zip --output ../${name}-master.zip master
cd ..
#delete the cloned repo
rm -fR ${name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment