I am new to GitHub and I am currently taking and online course for front-end development. I am currently trying to set up my development environment by syncing GitHub and my browser.
When I create a new repository on GitHub and publish my basic webpage it only creates a master
branch. From what I understand when I create my website a branch called gh-pages
should also be created.
This is not the case for me. Any insight would be appreciated.
Thankfully, GitHub does not automatically create a gh-pages
branch for you. Not all projects need a GitHub Pages site.
You can tell GitHub to publish a Pages site from a (manually-created) gh-pages
branch, from your master
branch, or from a docs/
folder in your master
branch in the GitHub Pages → Source section in your repository's Settings.
Exactly how you create your gh-pages
branch will depend on the tools you are using. Using the standard Git command-line you can use the git branch
, git checkout
, or git switch
command with its -c
option, e.g.
git switch -c gh-pages
to create a new gh-pages
branch and check it out.
Once you've committed some content, make sure to push your new branch go GitHub so your Pages site can use it.