Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion Creating a Project Pages Site

Christopher Mlalazi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 Points

Hosting on Github pages

This video deals with a website that does not yet have a repository. What if you want to publish on Github pages one that already has a repository what are the steps?

7 Answers

Kevin Korte
Kevin Korte
28,149 Points

I believe it would be a as simple as creating a "gh-pages" branch, and putting your html, css, and js files that compose the site into that branch.

Christopher Mlalazi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 Points

@Kevin no I am not still answered. My questions arises from this scenario. Following the steps in this video, I created an online repository on Github which I went on to have hosted on pages. But what I notice now is that the very same folder is not in my desktop Github, and if I try to load it as a new repository there, I get an alert which says that particular repository exists in Github - yes I know it exists on the online Github, but it is not being reflected on my desktop app. Is it necesarry for me to have this folder in the desktop Github in this case? Because I am thinking, what if I want to commit some new changes how do I do it?

Christopher Mlalazi
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 Points

rom one challenge to another. I must be thick. Now how do I make changes to the code in the Github pages website. I have tried to go back to my code on my desktop and made a change, but how do I commit that now and make it be visible in the website? I am suspecting it must be through command line, but I might as well be trying to read hieroglyphics there.

Kevin Korte
Kevin Korte
28,149 Points

So I'm not familiar with the videos at this time, but in general, if the repo already exists on github, than you need to clone the repo to your local machine. That will give you your own working copy, and make the connection between your local repo and the remote repo on github. Than when you wanted to make changes, you make the changes the to your local copy first, and than you push those changes to the remote repo, where they would than be reflected online. You would just have to make sure you where pushing to the gh-pages branch.

Kevin Korte
Kevin Korte
28,149 Points

so to push your gh-pages branch to your remote gh-pages branch so it would be live on the internet, you'd first want to make sure you are on your local gh-pages branch, by going git checkout gh-pages, and than push it, so git push origin gh-pages should do the trick.