Hosting a Personal Site
Part 1: Remotely
- + Menu > New repository > Name: yourusername.github.io (Personal site repo names has to be in this form)
- Fill out the Description
- Choose Public
- Press Create repository button
Part 2: Locally
- Enter the directory of the project site you want to host.
- Initialize repository inside project directory
git init git status
- Add, Commit and Push files to the master branch of the site repo.
git add . git commit -m "initial commit" git remote add origin <new repo link> git push origin master
Hosting a Project Site
Project sites are a great way to promote open source projects, as well as host simple front-end projects. Project Pages always use a branch called gh-pages.
Part 1: Locally
- Open local project
Change directory to the local directory of your project.git init git status ---- On branch master
- Create gh-pages branch
It must be on a branch called gh-pages, so we’ll create it.git checkout -b gh-pages git status ---- On branch gh-pages
- Add an commit files
git add . git commit -m "Initial commit"
Part 2: Remotely
Create repository, add remote connection, then push previous commits to gh-pages.
- + Menu > New repository > Name: simple to-do
- Press Create repository button
- Create remote connection
git remote add origin <repo link>
- Push commits into GitHub
git push origin gh-pages
- Refresh GitHub’s project page, and your project site should have been uploaded.
- Settings > GitHub Pages > Your site’s URL