GitHub Pages Import

2.1.0 · active · verified Sun Apr 05

ghp-import is a lightweight Python package designed to simplify the deployment of static content to GitHub Pages. It automates the process of copying built documentation or other static files to the `gh-pages` branch of a GitHub repository, then committing and pushing them. The current version is 2.1.0, and it has an infrequent but active release cadence, with the last major release in May 2022.

Warnings

Install

Imports

Quickstart

The most common way to use ghp-import is as a command-line tool, pointing it to your generated static files. The example shows how to deploy a 'docs_output' directory to the 'gh-pages' branch, automatically add a '.nojekyll' file (to prevent Jekyll processing), and push to the remote. It also includes a Python programmatic example for more advanced integration.

# Using as a command-line tool (recommended for typical use cases)
# Assuming your built documentation is in a 'docs_output' directory
# This command will create/update the gh-pages branch, add a .nojekyll file, and push.
ghp-import -n -p -f docs_output

# Using programmatically (if you need to integrate into a Python script)
from ghp_import import ghp_import

# Example: deploy 'build' directory, push to origin, include .nojekyll
ghp_import('build', push=True, nojekyll=True, mesg='Update GitHub Pages via script')

view raw JSON →