7. Publishing on Github

Chinese proverb

sharing your happiness is much better than enjoying your happiness by your own.

7.1. Create reStructuredTexts

7.1.1. Create reStructuredTexts

Use the tips in reStructuredText Markup to create your reStructuredTexts and add them in one folder, for example doc.

_images/doc.png

7.1.2. Add them in index.rst

========
Contents
========

.. toctree::
   :maxdepth: 2

   preface
   intro
   pkgs
   sphinx
   rtxt
   github
   reference

7.1.3. Compile the reStructuredTexts files

  1. Change the directory to the folder
cd MyTutorial/SphinxGithub/doc
  1. Compile
make

Then you should get two more folders: docs and latex.

_images/compiled.png

7.2. Create Repository on Github

_images/newr.png

7.3. Commit reStructuredTexts folder to Repository

Open Terminal and do the following steps:

git init

git add .
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

git remote add origin remote repository URL
# Sets the new remote
git remote -v
# Verifies the new remote URL

git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

7.4. Setup Github Pages on Github

7.4.1. Repository

Once you commited your repository to the Github, you will get:

_images/repository.png

7.4.2. Setup Github Pages

  1. Go to Settings button in your repository
_images/setting.png
  1. Set up the Github pages source
_images/githubpage.png
  1. Enjoy your Github Pages
_images/online.png