Skip to content

Commit d2f5054

Browse files
committedDec 24, 2015
Update github_deploy instructions in the manual
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent 3405df9 commit d2f5054

File tree

1 file changed

+53
-16
lines changed

1 file changed

+53
-16
lines changed
 

‎stories/manual.txt

+53-16
Original file line numberDiff line numberDiff line change
@@ -1102,25 +1102,62 @@ Deploying to GitHub
11021102
~~~~~~~~~~~~~~~~~~~
11031103

11041104
Nikola provides a separate command ``github_deploy`` to deploy your site to
1105-
GitHub pages. The command builds the site, commits the output to a gh-pages
1105+
GitHub Pages. The command builds the site, commits the output to a gh-pages
11061106
branch and pushes the output to GitHub. Nikola uses the `ghp-import command
11071107
<https://github.com/davisp/ghp-import>`_ for this.
11081108

1109-
The branch to use for committing the sources can be changed using the
1110-
``GITHUB_DEPLOY_BRANCH`` option in your config. For a
1111-
user.github.io/organization.github.io, this MUST be set to ``master``,
1112-
and the branch containing the sources must be changed to something
1113-
else, like ``deploy``, using the ``GITHUB_SOURCE_BRANCH`` option. The
1114-
remote name to which the changes are pushed is ``origin`` by default,
1115-
and can be changed using the ``GITHUB_REMOTE_NAME`` option. You also,
1116-
obviously, need to have ``git`` on your PATH, and should be able to
1117-
push to the repository specified as the remote.
1118-
1119-
This command performs the following actions, when it is run:
1120-
1121-
1. Builds the site
1122-
2. Commit the output folder to the ``GITHUB_DEPLOY_BRANCH`` to this branch.
1123-
3. Push the branch to the remote specified in ``GITHUB_REMOTE_NAME``!
1109+
In order to use this feature, you need to configure a few things first. Make
1110+
sure you have ``nikola`` and ``git`` installed on your PATH.
1111+
1112+
1. Initialize a Nikola site, if you haven’t already.
1113+
2. Initialize a git repository in your Nikola source directory by running:
1114+
1115+
.. code:: text
1116+
1117+
git init .
1118+
git remote add origin git@github.com:user/repository.git
1119+
1120+
3. Setup branches and remotes in ``conf.py``:
1121+
1122+
* ``GITHUB_DEPLOY_BRANCH`` is the branch where Nikola-generated HTML files
1123+
will be deployed. It should be ``gh-pages`` for project pages and
1124+
``master`` for user pages (user.github.io).
1125+
* ``GITHUB_SOURCE_BRANCH`` is the branch where your Nikola site source will be
1126+
deployed. We default to ``master``, but user pages should use ``src`` or
1127+
something else.
1128+
* ``GITHUB_REMOTE_NAME`` is the remote to which changes are pushed.
1129+
1130+
4. Create a ``.gitignore`` file. We recommend adding at least the following entries:
1131+
1132+
.. code:: text
1133+
1134+
cache
1135+
.doit.db
1136+
__pycache__
1137+
output
1138+
1139+
5. Switch to your source branch (if necessary) and commit to your source branch:
1140+
1141+
.. code:: text
1142+
1143+
git checkout -b src
1144+
git add .
1145+
git commit -am "Initial commit"
1146+
1147+
6. Run ``nikola github_deploy``. This will build the site, commit the output
1148+
folder to your deploy branch, and push to GitHub. Your website should be up
1149+
and running within a few minutes.
1150+
7. You should push your source branch to GitHub, too — this way, you have a
1151+
backup in case of catastrophic disk failure, and you can work on your
1152+
website from around the world.
1153+
1154+
.. code:: text
1155+
1156+
git push -u origin src
1157+
1158+
If you want to use a custom domain, create your ``CNAME`` file in
1159+
``files/CNAME`` on the source branch. Nikola will copy it to the
1160+
output directory.
11241161

11251162
Comments and Annotations
11261163
------------------------

1 commit comments

Comments
 (1)

jean commented on Dec 24, 2015

@jean
Contributor

Cool :-) This addresses all the issues I came across setting up my Hello world page.

Please sign in to comment.