Remember the ‘my-site’ part for later on when using heroku create
. Also, my-site is often called ‘app-name’ in Heroku documentation.
Within your new site repository or orphaned github branch (the branch could be named anything except ‘gh-pages’ since this would then be public on GitHub!), add gem 'jekyll-auth'
to your Gemfile
or if you don’t already have a Gemfile
, create a file called Gemfile
in the root of your site’s repository with the following content:
source "https://rubygems.org"
gem 'jekyll-auth'
cd
into your project’s directory and run bundle install
. If you get an error using bundle install
, see Troubleshooting below.
Run bundle exec jekyll-auth new
which will copy the necessary files to set up the server
Run bundle exec jekyll-auth setup --client_id XXX --client_secret XXX --org_name XXX
(or --team_id XXX
)
jekyll-auth new
to Git before continuingheroku create my-site
from your site’s directory; make sure my-site matches what you specified in the GitHub application registration above.heroku config:set GITHUB_CLIENT_ID=XXX GITHUB_CLIENT_SECRET=XXX GITHUB_ORG_NAME=XXX
(or GITHUB_TEAM_ID
)git push heroku
, or if you are maintaining the site in an orphaned branch of your GitHub repo (say ‘heroku-pages’), do git push heroku heroku-pages:master
heroku open
to open the site in your browserIf you need to find an organization’s ID, you can use the following cURL command:
curl https://api.github.com/orgs/{org_name}
If you need help finding a team’s numeric ID, you can use the jekyll-auth team_id
command.
For example, to find the team ID for @jekyll/maintainers you’d run the command:
jekyll-auth team_id --org jekyll --team maintainers
You’ll want to add a personal access token to your .env
file so that Jekyll-Auth can make the necessary API request, but the command will run you through the process if you do not provide this.