Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exclude source files (e.g. GitHub pages) from the automatic github Zipball / Tarball creation

I usually host a projects GitHub pages (docs/) and build service configration files (e.g. .travis.yml or .appveyor.yml) together with the projects source in the master branch. When creating a release, github creates a zip and a tar archive (the so called zipball and tarball), which can also be created these links:

https://api.github.com/repos/:user/:project/tarball
https://api.github.com/repos/:user/:project/zipball

or for a specific release:

https://api.github.com/repos/:user/:project/tarball/:tag
https://api.github.com/repos/:user/:project/zipball/:tag

These archives contain all the files found in the projects repository. To exclude repository content from being added to these archives, e.g. the complete the docs/ folder, one can add files and folders marked as export-ignore to the file .gitattributes and add this file to the repository. Mine usually looks like this:

/docs export-ignore
.appveyor.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
README.md export-ignore

The resulting zipballs and tarballs will no longer contain any of the files and folders marked as export-ignore. This helps me to keep the automatically created source archives clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment