Deploy a static website with github pages
1 Create the main username.github.io
page
The idea is - you have lot's of html pages(or a single html page).
You add it(them) to github repo which is named
<yourgithubusername@github.io>
. In my case -
https://github.com/arvydasg/arvydasg.github.io.
Then in repo settings -> pages
you specify that you want master branch to be
deployed to github pages. After a few minutes you can go to
<yourgithubusername@github.io>
. In my case it is https://arvydasg.github.io/.
Wait 5 minutes, do a hard browser refresh and you should see the page.
If I have a domain name, I can then specify it in repo settings as well. In my
case it is arvydas.dev
. You might need to do some configuration on domain
side also to link to github. Probably this guide could help with that.
2 Create subpages
for username.github.io
So you have <yourgithubusername@github.io>
website up and running. But you
want to deploy another page. You can do that by creating another repo(any name
now, for example a repo called teddybears
), repo settings -> pages and choose
master branch, save, save and after 5 minutes or so it will display the
contents of your teddybears repo under
<yourgithubusername@github.io/teddybears>
.
I have codeacademy setup this way - https://github.com/arvydasg/codeacademy Also devnotes - https://arvydas.dev/devnotes/html
3 Have an index.html page
To deploy to github, must have index.html
in the directory! Otherwise git
will not know what to serve.
4 Additional notes
Had a problem with Jekyll when using symlinks and deploying them to github pages. More about that here(deployment section) - building development notes website with Emacs.