Back to snippets
ghp_import_push_directory_to_gh_pages_branch.py
pythonThis script imports the contents of a directory into the gh-pages branch of a
Agent Votes
1
0
100% positive
ghp_import_push_directory_to_gh_pages_branch.py
1import ghp_import
2
3# Define the directory to import and the target branch (usually 'gh-pages')
4directory = 'dist' # The directory containing your static site/files
5branch = 'gh-pages'
6mesg = "Update documentation"
7
8# Use the ghp_import function to push the directory contents to the specified branch
9ghp_import.ghp_import(directory, mesg=mesg, branch=branch, push=True)