Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
GitHub provides a simple hosting solution called GitHub Pages that lets others view your repository like any other website.
Resources
Video review
- GitHub Pages does not work with sites that use a server-side language, because it can't execute languages like Ruby, Python, or PHP.
- GitHub Pages only works with static websites containing HTML, CSS, and JavaScript files.
- There are two types of websites you can store on GitHub Pages: User Pages and Project Pages.
- User Pages are stored in a special repository dedicated to your GitHub Pages files.
- As a GitHub user, youβre entitled to one free user website per account.
- With Project Pages, each repository in your GitHub account can have its own website.
- Project Pages sites are served under a subpath that matches a repository's name.
- User Pages sites do not display a subpath in the URL.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hey everyone I'm Gil, a friend and
teacher here at Treehouse.
0:04
In this workshop I'm gonna show you how
to host your website on GitHub Pages
0:08
for free.
0:12
Did you know you can do that?
0:13
By now you know that Git is a version
control system commonly used for
0:14
collaborating on open source projects.
0:18
And GitHub is a website that lets
you host Git repositories online, so
0:21
that others can see your projects,
use them and work on them with you.
0:24
For example, with GitHub,
0:29
you can share your code with other
people on the web community.
0:30
Or if you work in an organization, you can
have an organizational GitHub account,
0:33
where all the developers put their code,
pull down the current code for
0:37
the project, and work on it together.
0:40
Now, a repository is just
a collection of files,
0:43
like the files used in your website
that you keep track of with Git.
0:46
Normally when you put a website project or
any project up on GitHub,
0:50
you're just storing the website's
files in a repository.
0:54
But GitHub also provides a simple hosting
solution called GitHub Pages that lets
0:58
others view your repository
just like any other website.
1:03
In fact, you can host multiple
websites and it's all completely free.
1:06
So, you don't have to go
through hosting providers or
1:10
the tedious process of
setting up a hosting package.
1:13
This is why many popular websites
are hosted on GitHub Pages.
1:17
For example, the websites for
Twitter Bootstrap and server Foundation,
1:21
are stored and served from GitHub Pages.
1:25
Now there are some limitations on
the types of sites you can host with
1:28
GitHub Pages.
1:31
GitHub Pages does not work with sites
that use a server side language,
1:33
because it can't execute languages
like Ruby, Python or PHP.
1:37
GitHub Pages works with
static websites only.
1:41
These are sites Containing HTML,
CSS and JavaScript files.
1:44
There are two types of websites you can
store on GitHub Pages, user pages and
1:48
project pages.
1:52
Both types are similar and can host the
same kind of websites, you just create and
1:54
store them differently
within GitHub Pages.
1:58
I'll cover how to create
the two types soon, but first,
2:01
let's go over a few important differences
between user pages and project pages.
2:04
User pages are stored in a special
repository dedicated to your GitHub Pages
2:10
files.
2:14
As a GitHub user, you're entitled to
one free user website per account.
2:15
User pages are commonly used for
hosting a portfolio website or
2:19
an organization's main website.
2:23
With project pages,
2:26
each repository in your GitHub
account can have its own website.
2:27
If you have repositories for several
open source projects, you can host and
2:30
publish a website for each project.
2:34
That's how Foundation and
Bootstrap host our websites.
2:36
Also the URL structure GitHub uses for
2:39
project pages is slightly different from
the URL structure used for user pages.
2:42
Project pages sites are served under a sub
path that matches a repository's name.
2:48
The URL for a project pages
website will look like this.
2:53
The username followed by the GitHub Pages
domain, and the repository name.
2:57
User pages sites do not
display a sub path in the URL,
3:02
they display the username followed
by the GitHub Pages domain.
3:05
But as you'll soon learn, you can use
your own custom domain that points to
3:10
a website stored as either user pages or
project pages.
3:14
Now that you know a little
bit about GitHub Pages,
3:18
it's time to get your site published.
3:20
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up