The Question :
377 people think this question is useful
For example this: https://github.com/necolas/css3-social-signin-buttons/blob/master/index.html
When I open this it doesn’t show the rendered HTML of the code of author. It shows the page as a source code.
Is it possible to see it as rendered HTML directly? Otherwise I always need to download the whole ZIP just to see the result.
The Question Comments :
The Answer 1
488 people think this answer is useful
The Answer 2
90 people think this answer is useful
If you don’t want to download an archive you can use GitHub Pages to render this.
- Fork the repository to your account.
- Clone it locally on your machine
- Create a
gh-pages branch (if one already exists, remove it and create a new one based off
- Push the branch back to GitHub.
- View the pages at
git clone email@example.com:username/repo.git
git branch gh-pages
# Might need to do this first: git branch -D gh-pages
git push -u origin gh-pages # Push the new branch back to github
Go to http://username.github.io/repo
The Answer 3
65 people think this answer is useful
You can use RawGit:
It works better (at the time of this writing) than http://htmlpreview.github.com/, serving files with proper Content-Type headers.
Additionally, it also provides CDN URL for use in production.
The Answer 4
36 people think this answer is useful
It’s really easy to do with github pages, it’s just a bit weird the first time you do it. Sorta like the first time you had to juggle 3 kittens while learning to knit. (OK, it’s not all that bad)
You need a gh-pages branch:
Basically github.com looks for a gh-pages branch of the repository. It will serve all HTML pages it finds in here as normal HTML directly to the browser.
How do I get this gh-pages branch?
Easy. Just create a branch of your github repo called
--orphan when you create this branch, as you don’t actually want to merge this branch back into your github branch, you just want a branch that contains your HTML resources.
$ git checkout --orphan gh-pages
What about all the other gunk in my repo, how does that fit in to it?
Nah, you can just go ahead and delete it. And it’s safe to do now, because you’ve been paying attention and created an orphan branch which can’t be merged back into your main branch and remove all your code.
I’ve created the branch, now what?
You need to push this branch up to github.com, so that their automation can kick in and start hosting these pages for you.
git push -u origin gh-pages
But.. My HTML is still not being served!
It takes a few minutes for github to index these branches and fire up the required infrastructure to serve up the content. Up to 10 minutes according to github.
The steps layed out by github.com
The Answer 5
15 people think this answer is useful
I read all the comments and thought that GitHub made it too difficult for normal user to create GitHub pages until I visited GitHub theme Page where its clearly mentioned that there is a section of “GitHub Pages” under settings Page of the concerned repo where you can choose the option “use the master branch for GitHub Pages.” and voilà!!…checkout that particular repo on https://username.github.io/reponame
The Answer 6
1 people think this answer is useful
This isn’t a direct answer, but I think it is a pretty sweet alternative.
It allows you to host your pages behind basic auth. Great for things like api docs in your private github repo. just ad a s3 put as part of your api build.
The Answer 7
1 people think this answer is useful
Also, if you use Tampermonkey, you can add a script that will add
preview with http://htmlpreview.github.com/ button into actions menu beside ‘raw’, ‘blame’ and ‘history’ buttons.
Script like this one:
The Answer 8
0 people think this answer is useful
I have found another way:
- Click on the “Raw” button if you haven’t already
- Ctrl+A, Ctrl+C
- Open “Developer Tools” with F12
- In the “Inspector” right-click on the tag and choose “Edit HTML”
- Ctrl+A, Ctrl+V
Tested on Firefox but it should work in other browsers too
The Answer 9
-2 people think this answer is useful
You can just turn on Github Pages. ^_^
Click on “Settings”, than go to “GitHub Pages” and click on dropdown under “Source” and choose branch which you want to public (where main html file is located) aaaand vualaa. ^_^