by github-modules


Heroku Buildpack for GitHub Authentication

This is a Heroku buildpack that enables authenticated GitHub operations within a Heroku dyno.

It detects a GITHUB_AUTH_TOKEN environment variable and creates a .netrc file with a GitHub entry.

It is the soul sister of the npm Buildpack.

See the blog post: npm and GitHub automation with Heroku


First, create a new GitHub access token at

Then save this token in your Heroku app's config:


Then configure your app to use this buildpack:

heroku buildpacks:add --index 1 zeke/github

The next time you push your app to Heroku, this buildpack will create a .netrc file containing your GitHub token in the base directory of the app:

heroku run bash
cat .netrc
machine login YOUR_TOKEN_HERE password x-oauth-basic

Now you can perform authenticated git operations on the dyno. Note that if you want to git commit, you'll need to specify the git user and email:

git clone
cd some-private-repo
git config ""
git config "Zeke Sikelianos"
touch some/file
git commit -am "git commit from a dyno!"
git push origin master

Using the latest source code

The zeke/github buildpack from the Heroku Buildpack Registry represents the latest stable version of the buildpack. If you'd like to use the source code from this Github repository, you can set your buildpack to the Github URL:

heroku buildpacks:add --index 1




This buildpack was inspired by @timshadel/heroku-buildpack-github-netrc, but the two differ in one significant way: the @timshadel buildpack allows authenticated requests to be made only at build time (i.e. when your app is being deployed), whereas this buildpack allows authenticated requests at build time and/or run time (when your app is actually running).