Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughExporting a Git Repository
Have you ever needed or wanted to pull a remote Git Repository on Drupal.org down as a zip or tarball? You know, the way Github does? Most project releases have fairly recently built tarballs which is awesome - but Sandboxes do not (so it seems - please correct me if I'm wrong!).
The following snippet lets you "archive" a remote repository, pull it down as a tarball, and extract it in-place:
git archive --format=tar --prefix=PROJECT/ [email protected]:sandbox/USERNAME/123456789.git BRANCH | tar -xf -
Some important notes:
- The prefix is very important - without it, tar extracts to the current folder.
- The trailing slash on the prefix is equally important - without it all files have PROJECT at the beginning!
- The number (next to .git) references the sandbox Node ID.
I have tried using the "zip" format, however the unzip
bash command doesn't accept stdin
as a source. It looks like funzip
might hold some promise thought…
EDIT: - looks like you can only do this if your user has access to the repository.
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web