Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
      You have completed GitHub Basics!
      
    
You have completed GitHub Basics!
Preview
    
      
  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.
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
                      Another great way to use GitHub pages
is to create a project website.
                      0:00
                    
                    
                      As we showed earlier, project sites are
used to promote open source projects and
                      0:04
                    
                    
                      also to host simple front end projects.
                      0:08
                    
                    
                      The steps to create a project site
are very similar to what we did to create
                      0:10
                    
                    
                      the portfolio page with
one important difference.
                      0:14
                    
                    
                      Instead of being on the master branch,
                      0:17
                    
                    
                      project pages always use
a branch called GH pages.
                      0:19
                    
                    
                      We'll use an example from the front
end track to show you how
                      0:23
                    
                    
                      to host your project site.
                      0:26
                    
                    
                      Starting in the consul you'll CD into
the folder where the project is.
                      0:29
                    
                    
                      Now, lets open the folder,
                      0:33
                    
                    
                      we'll double click on this
index.html file to see our project.
                      0:35
                    
                    
                      There it is,
a simple to-do list application.
                      0:40
                    
                    
                      But once we host it on GitHub pages,
we'll be able to use it from anywhere.
                      0:43
                    
                    
                      Again, hosting a project on GitHub is
great practice in using the git commands
                      0:47
                    
                    
                      and branching workflow,
while also showcasing your work.
                      0:51
                    
                    
                      Okay, let's go back to the console.
                      0:55
                    
                    
                      First, we'll git init and
then type get status.
                      0:57
                    
                    
                      Okay we're on the master branch but
we need to be on a branch called gh pages.
                      1:03
                    
                    
                      So we'll use the command
git checkout dash b
                      1:08
                    
                    
                      gh dash pages to create the new
gh pages branch and switch to it.
                      1:12
                    
                    
                      If we run the git status command again,
                      1:17
                    
                    
                      we'll see that we're now
on the gh pages branch.
                      1:20
                    
                    
                      Next, we'll run git add
period to add the files and
                      1:23
                    
                    
                      then git commit dash m to make the commit.
                      1:27
                    
                    
                      Next we'll need to create
the repository and
                      1:32
                    
                    
                      add the remote connection,
I'll navigate to my GitHub profile and
                      1:34
                    
                    
                      click the plus on the top right and
choose new repository.
                      1:38
                    
                    
                      Here I'll enter the name of my
repository and add a short description.
                      1:43
                    
                    
                      Great, now all I need to do
is click create repository.
                      1:52
                    
                    
                      Now, I'll copy this command.
                      1:57
                    
                    
                      And, paste it into my console, so
                      2:01
                    
                    
                      that I can create the remote
connection to GitHub.
                      2:04
                    
                    
                      Now, I'll type git push origin gh-pages
to push the code up to GitHub.
                      2:08
                    
                    
                      And, then when I go back to GitHub and
refresh, there's all of our project code.
                      2:16
                    
                    
                      I'll go to my settings now and
scroll down.
                      2:22
                    
                    
                      And I can see the URL where this
GitHub page's site is hosted.
                      2:25
                    
                    
                      If I click on it, there it is.
                      2:29
                    
                    
                      There's our simple to do list application,
live.
                      2:32
                    
                    
                      Then, to publish any additional changes or
commits, I'll just add, commit, and push.
                      2:35
                    
                    
                      And the changes will update the site.
                      2:40
                    
                    
                      Since we're using Git,
                      2:42
                    
                    
                      we'll have a history of all of the changes
if we ever want to go back in time.
                      2:43
                    
              
        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