There are two basic types of GitHub Pages: User Pages and Project Pages.
A User Page is connected to a special, public repo you create for it. The name of the repo has to be yourGithubUserName.github.io
. You can have only one user page per Github account.
A Project Page: any repo can have a project page. Even if the repo is private, the Project Page will be public. It can be on the master branch, or a branch named gh-pages.
A. Create a Github Project Page
You can create a Project Page for any of your 281 repos. Pick one, and do the following:
- Open your repo in Chrome, and click Settings in the upper-right. Scroll to Github Pages section, select the Master branch, and use the Theme Chooser to select a theme.This will add a _config.yaml file to your remote repo, which adds the theme to your user page.See Changing your README.md, below.
- The content in your README.md on Github will be used for the Project Page.
You can also create a new file named index.md or index.html in your local repo, add content to that file, and push it to Github. You can have both README and index files in your repo. Since index.md (or .html) is the default document, it will be used by Github for your Project Page if it is present. Otherwise, README.md will be used.
- The Settings > Github Pages section of your repo shows the link to connect to your Project Page.
B. Pick a Theme for your Project Page
Open your remote repo in Chrome, and click Settings in the upper-right. Scroll to Github Pages section, and use the Theme Chooser to select a theme.
Selecting a theme will add a _config.yaml file to your remote repo, which applies the theme to your user page hosted at .github.io.
The theme is not applied to your local index.html page. To view the themed page you will have to push your changes to the remote repo, and then reload your User Page hosted at <yourGHusername>github.io.
Sync your Local and Remote Repos:
The Pull Command
When you pick a Jekyll theme for your Project page, that creates a new file (_config.yml) in your remote repo. Therefore, the remote repo has changes that are not in the local repo.
If you attempt to push from the local to the remote, git will respond with a “![rejected]” error.
Solution: run the Git Pull command to sync the local and remote repos.
Pull and Merge the Remote Changes
Run this shell command:
git pull origin master --no-edit
After pulling your changes from the remote repo, you should be able to use the push command as usual.
If the usual push command does not work, use the force push command once. After that, the usual push command will work:
git push -f origin master