@@ -1158,21 +1158,58 @@ GitHub pages. The command builds the site, commits the output to a gh-pages
1158
1158
branch and pushes the output to GitHub. Nikola uses the `ghp-import command
1159
1159
<https://github.com/davisp/ghp-import>`_ for this.
1160
1160
1161
- The branch to use for committing the sources can be changed using the
1162
- ``GITHUB_DEPLOY_BRANCH`` option in your config. For a
1163
- user.github.io/organization.github.io, this MUST be set to ``master``,
1164
- and the branch containing the sources must be changed to something
1165
- else, like ``src``, using the ``GITHUB_SOURCE_BRANCH`` option. The
1166
- remote name to which the changes are pushed is ``origin`` by default,
1167
- and can be changed using the ``GITHUB_REMOTE_NAME`` option. You also,
1168
- obviously, need to have ``git`` on your PATH, and should be able to
1169
- push to the repository specified as the remote.
1170
-
1171
- This command performs the following actions, when it is run:
1172
-
1173
- 1. Builds the site
1174
- 2. Commit the output folder to the ``GITHUB_DEPLOY_BRANCH`` to this branch.
1175
- 3. Push the branch to the remote specified in ``GITHUB_REMOTE_NAME``!
1161
+ In order to use this feature, you need to configure a few things first. Make
1162
+ sure you have ``nikola`` and ``git`` installed on your PATH.
1163
+
1164
+ 1. Initialize a Nikola site, if you haven’t already.
1165
+ 2. Initialize a git repository in your Nikola source directory by running:
1166
+
1167
+ .. code:: text
1168
+
1169
+ git init .
1170
+ git remote add origin git@github.com:user/repository.git
1171
+
1172
+ 3. Setup branches and remotes in ``conf.py``:
1173
+
1174
+ * ``GITHUB_DEPLOY_BRANCH`` is the branch where Nikola-generated HTML files
1175
+ will be deployed. It should be ``gh-pages`` for project pages and
1176
+ ``master`` for user pages (user.github.io).
1177
+ * ``GITHUB_SOURCE_BRANCH`` is the branch where your Nikola site source will be
1178
+ deployed. We default to ``master``, but user pages should use ``src`` or
1179
+ something else.
1180
+ * ``GITHUB_REMOTE_NAME`` is the remote to which changes are pushed.
1181
+
1182
+ 4. Create a ``.gitignore`` file. We recommend adding at least the following entries:
1183
+
1184
+ .. code:: text
1185
+
1186
+ cache
1187
+ .doit.db
1188
+ __pycache__
1189
+ output
1190
+
1191
+ 5. Switch to your source branch (if necessary) and commit to your source branch:
1192
+
1193
+ .. code:: text
1194
+
1195
+ git checkout -b src
1196
+ git add .
1197
+ git commit -am "Initial commit"
1198
+
1199
+ 6. Run ``nikola github_deploy``. This will build the site, commit the output
1200
+ folder to your deploy branch, and push to GitHub. Your website should be up
1201
+ and running within a few minutes.
1202
+ 7. You should push your source branch to GitHub, too — this way, you have a
1203
+ backup in case of catastrophic disk failure, and you can work on your
1204
+ website from around the world.
1205
+
1206
+ .. code:: text
1207
+
1208
+ git push -u origin src
1209
+
1210
+ If you want to use a custom domain, create your ``CNAME`` file in
1211
+ ``files/CNAME`` on the source branch. Nikola will copy it to the
1212
+ output directory.
1176
1213
1177
1214
Comments and Annotations
1178
1215
------------------------
0 commit comments