All Projects → c-w → Ghp Import

c-w / Ghp Import

Licence: apache-2.0
Easily import docs to your gh-pages branch.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
python2
120 projects

Labels

Projects that are alternatives of or similar to Ghp Import

TimeTableManager
Simple react application to create a TimeTable based only on your choice of subjects.
Stars: ✭ 30 (-93.78%)
Mutual labels:  gh-pages
angular-loading-button
Loading button directive for AngularJS
Stars: ✭ 27 (-94.4%)
Mutual labels:  gh-pages
angular-forum
Forum application built with Angular
Stars: ✭ 52 (-89.21%)
Mutual labels:  gh-pages
miguelmota.github.com
My Hugo powered blog
Stars: ✭ 34 (-92.95%)
Mutual labels:  gh-pages
jekyll-grid
Jekyll theme (used on 25x52.com) displays posts in a grid. Ideal for projects
Stars: ✭ 63 (-86.93%)
Mutual labels:  gh-pages
rickroll-links
Juicy rickroll links
Stars: ✭ 15 (-96.89%)
Mutual labels:  gh-pages
github-deploy-actions
This action will auto deploy to target branch when it get triggered
Stars: ✭ 24 (-95.02%)
Mutual labels:  gh-pages
Jekyll Klise
🏖 Klisé is a minimalist Jekyll theme for running a personal site or blog, light & dark mode support. (https://klise.now.sh)
Stars: ✭ 312 (-35.27%)
Mutual labels:  gh-pages
jekyll-deploy-action
🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
Stars: ✭ 162 (-66.39%)
Mutual labels:  gh-pages
GFontsSpace
Preview: https://pankajladhar.github.io/GFontsSpace
Stars: ✭ 88 (-81.74%)
Mutual labels:  gh-pages
Documentation
Kodular Documentation
Stars: ✭ 41 (-91.49%)
Mutual labels:  gh-pages
horcrux
Generate you own online gallery easily. Photo is the horcrux of memory.
Stars: ✭ 34 (-92.95%)
Mutual labels:  gh-pages
vue-cli-ghpages
Made for vue-cli users. Publish to any gh-pages branch on GitHub. The Single-Page App Hack for GitHub Pages.
Stars: ✭ 25 (-94.81%)
Mutual labels:  gh-pages
twist
📡 Static and serverless canonical imports for your Go packages
Stars: ✭ 23 (-95.23%)
Mutual labels:  gh-pages
gh-pages-action
A GitHub Action to deploy a static site on GitHub Pages.
Stars: ✭ 26 (-94.61%)
Mutual labels:  gh-pages
devilbox.org
devilbox website: http://devilbox.org
Stars: ✭ 74 (-84.65%)
Mutual labels:  gh-pages
volodymyrkushnir.dev
My very own personal website. Basically this is just a résumé.
Stars: ✭ 16 (-96.68%)
Mutual labels:  gh-pages
Ghost On Github Pages
Ghost on Github Pages. Build and deploy Ghost for free in a few minutes.
Stars: ✭ 421 (-12.66%)
Mutual labels:  gh-pages
Linux Command
Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。https://git.io/linux
Stars: ✭ 17,481 (+3526.76%)
Mutual labels:  gh-pages
denysdovhan.github.io
📰 Personal blog from Denys Dovhan
Stars: ✭ 18 (-96.27%)
Mutual labels:  gh-pages

GitHub Pages Import

CI status CircleCI TravisCI AzureDevOps

License Version

As part of gunicorn, Benoit Chesneau and I have been starting to look at how to host documentation. There's the obvious method of using GitHub's post-receive hook to trigger doc builds and rsync to a webserver, but we ended up wanting to try out github's hosting to make the whole interface a bit more robust.

GitHub Pages is a pretty awesome service that GitHub provides for hosting project documentation. The only thing is that it requires a gh-pages branch that is the site's document root. This means that keeping documentation sources in the branch with code is a bit difficult. And it really turns into a head scratcher for things like Sphinx that want to access documentation sources and code sources at the same time.

Then I stumbled across an interesting looking package called github-tools that looked almost like what I wanted. It was a tad complicated and more involved than I wanted but it gave me an idea. Why not just write a script that can copy a directory to the gh-pages branch of the repository. This saves me from even having to think about the branch and everything becomes magical.

This is what ghp-import was written for.

Big Fat Warning

This will DESTROY your gh-pages branch. If you love it, you'll want to take backups before playing with this. This script assumes that gh-pages is 100% derivative. You should never edit files in your gh-pages branch by hand if you're using this script because you will lose your work.

Usage

Usage: ghp-import [OPTIONS] DIRECTORY

Options:
  -n, --no-jekyll       Include a .nojekyll file in the branch.
  -c CNAME, --cname=CNAME
                        Write a CNAME file with the given CNAME.
  -m MESG, --message=MESG
                        The commit message to use on the target branch.
  -p, --push            Push the branch to origin/{branch} after committing.
  -x PREFIX, --prefix=PREFIX
                        The prefix to add to each file that gets pushed to the
                        remote. [none]
  -f, --force           Force the push to the repository
  -r REMOTE, --remote=REMOTE
                        The name of the remote to push to. [origin]
  -b BRANCH, --branch=BRANCH
                        Name of the branch to write to. [gh-pages]
  -s, --shell           Use the shell when invoking Git. [False]
  -l, --follow-links    Follow symlinks when adding files. [False]
  -h, --help            show this help message and exit

Its pretty simple. Inside your repository just run ghp-import $DOCS_DIR where $DOCS_DIR is the path to the built documentation. This will write a commit to your gh-pages branch with the current documents in it.

If you specify -p it will also attempt to push the gh-pages branch to GitHub. By default it'll just run git push origin gh-pages. You can specify a different remote using the -r flag.

You can specify a different branch with -b. This is useful for user and organization page, which are served from the master branch.

Some Windows users report needing to pass Git commands through the shell which can be accomplished by passing -s.

The -l option will cause the import to follow symlinks for users that have odd configurations that include symlinking outside of their documentation directory.

Python Usage

You can also call ghp_import directly from your Python code as a library. The library has one public function ghp_import.ghp_import, which accepts the following arguments:

  • srcdir: The path to the built documentation (required).
  • remote: The name of the remote to push to. Default: origin.
  • branch: Name of the branch to write to. Default: gh-pages.
  • mesg: The commit message to use on the target branch. Default: Update documentation.
  • push: Push the branch to {remote}/{branch} after committing. Default: False.
  • prefix: The prefix to add to each file that gets pushed to the remote. Default: None.
  • force: Force the push to the repository. Default: False.
  • use_shell: Default: Use the shell when invoking Git. False.
  • followlinks: Follow symlinks when adding files. Default: False.
  • cname: Write a CNAME file with the given CNAME. Default: None.
  • nojekyll: Include a .nojekyll file in the branch. Default: False.

With Python's current working directory (cwd) inside your repository, do the following:

from ghp_import import ghp_import
ghp_import('docs', push=True, cname='example.com')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].