How to fetch a GitHub repository for a specific commit efficiently?

Viewed 1952

I'm trying to build a continuous integration system. Each push to GitHub will trigger a build.

Each build will need to checkout/download the repository for the commit it's processing. I'm trying to find a way to do that that would not take minutes on large repositories (because the build takes a few seconds only…).

Please note that I do not want to store data between builds (that removes the possibility of caching).

The solutions I've explored:

Every other solution I see on GitHub assumes either a recent git version on the server, or that it's fine to clone the repository once but in my case it's not. I'm starting from scratch on every build (because that's a constraint).

So I'm asking in the specific case of GitHub: how can I download (in any way) the code at a specific commit to be able to run continuous integration tools on that commit?

1 Answers
Related