If you're familiar with command-line Git, it's straightforward to manually create a Project Pages site.
Make a fresh clone
To set up a Project Pages site, you need to create a new "orphan" branch (a branch that has no common history with an existing branch) in your repository. The safest way to do this is to start with a fresh clone:
git clone github.com/user/repository.git # Clone our repository Cloning into 'repository'... remote: Counting objects: 2791, done. remote: Compressing objects: 100% (1225/1225), done. remote: Total 2791 (delta 1722), reused 2513 (delta 1493) Receiving objects: 100% (2791/2791), 3.77 MiB | 969 KiB/s, done. Resolving deltas: 100% (1722/1722), done.
Create a gh-pages branch
Once you have a clean repository, you'll need to create the new
gh-pages branch and remove all content from the working directory and index:
cd repository git checkout --orphan gh-pages # Creates our branch, without any parents (it's an orphan!) Switched to a new branch 'gh-pages' git rm -rf . # Remove all files from the old working tree rm '.gitignore'
gh-pages branch won't appear in the list of branches generated by
git branch until you make your first commit.
Add content and push
In order to trigger a build when you push to your Page's repository, you must first verify your email address.
Now you have an empty working directory. You can create some content in this branch and push it to GitHub. For example:
echo "My Page" > index.html git add index.html git commit -a -m "First pages commit" git push origin gh-pages
Your GitHub Pages site should now be available. You'll receive an email if your build is unsuccessful.
Load your new GitHub Pages site
After your push to the
gh-pages branch, your Project Pages site will be available at
. Note that Pages are always publicly accessible when published, even if their repository is private.
To set up a custom domain for GitHub Pages sites, see Setting up a custom domain with GitHub Pages.