Host your own website on a GitHub subdomain

I've recently started learning Git, and part of that is of course learning the ropes at GitHub. One hidden little feature I found (at least I didn't find it advertised anywhere) is GitHub Pages. GitHub Pages lets you host a static website under a subdomain of https://github.com.

To use this feature, all you have to do is create a repository with the name [username].github.com (replacing [username] with your actual username) and then push your website's files to the repository. GitHub will automatically build your website every time you push changes to the repository and make it available at [username].github.com. As I mentioned before, you can only host static files, .htaccess files won't work either.

GitHub Pages is designed to be used for hosting documentation for your projects, but can be used just as well for hosting other simple websites. It's available to both free and paid accounts.

It's also possible to get GitHub to automatically build project sites for a specific repository in a sub directory of your subdomain by creating a special branch in that repository. For more information about this feature and others, visit the GitHub Pages home page.

GitHub Comments

  1. skopp

    How exactly is this working. What magic is this?!

  2. Rowno

    @skopp What are you referring to?

  3. skopp

    @Rowno I commented to your blog there. Immediate relay to it

  4. skopp

    I'm interested in sub-modules too.... how could I get an Li3 submodules to a grandmaster > gh-pages / master / dev > ___? sort of setup?

  5. Rowno

    I'm not sure what you're trying to achieve (I don't know anything about Li3), but GitHub will automatically pull in submodules during page build.

  6. skopp

    Thanks... I imagine it's the submodule concept that's the main bit, regardless of the repo.
    I've got a weird issue, nobody has been able to answer this one yet and yes, I read the manual :)

  7. skopp

    I guess I'm just doing some "homework" before trying blindly and making a mess. May I ask you to verify my assumption that if I git init a repo within an already initialized repo it becomes a submodule (provided it's compatible)?

    Eg.
    cd My_files/repoA && git init
    I then do whatever and commit and push.

    Then if later on, I start, say a lithium or jekyll repo by:

    cd My_files/repoA
    git clone git://*.lithium.git
    git init
    Code as needed, commit, push. So that repo is at ../repoA/lithium - is that how a submodule, or one way a submodule would work?

    Thanks in adv

    Regards, MR Essop

    -----Original Message-----
    From: Roland Warmerdam notifications@github.com
    Date: Mon, 10 Dec 2012 22:28:51
    To: Rowno/rolandwarmerdam.co.nzrolandwarmerdam.co.nz@noreply.github.com
    Reply-To: "Rowno/rolandwarmerdam.co.nz" reply@reply.github.com
    Cc: skoppskopp888@gmail.com
    Subject: Re: [rolandwarmerdam.co.nz] Host your own website on a GitHub
    subdomain (#2)

    I'm not sure what you're trying to achieve, but GitHub will automatically pull in submodules during page build.


    Reply to this email directly or view it on GitHub:
    #2 (comment)

  8. Rowno

    That won't work, you have to use the git submodule command. Read through the Submodules documentation.

  9. skopp

    Thanks a ton! Just needed clarification on that specifically. I apologize
    if I'm being a nuisance; for what it's worth you've helped a lot, more than
    any book could - and I appreciate that. I've got one last 'query' which is
    actually what got me to the assumption that a type of sub-something worked
    that way.

    When I just started learning about Git and related, I inited in - let's
    call it My_documents\my_git_apps thereby initializing ../my_git_apps a
    repo itself, unwittingly. Up until recently, it remained like that; and I
    kept adding repos in a similar fashion as
    ../my_git_apps/awesome-git-example/.git

    It always bothered me at the back of my, though, that I had a hidden .git
    folder in "my git apps", but I was afraid to simply delete it. Then I
    stumbled upon this weird repo with no
    branches, and no search or asking people on the net yielded positive
    results.

    Fast forward a bit... I did rm -rf .git on said .git folder, and noticed
    immediately changes - e.g. in the Git Bash the colors of everything were
    different
    What am I saying/asking? Well, I think we kinda ruled out that all my repos
    under that aren't/weren't "submodules", but... were they children of a
    parent aka a grandmaster as seen here?

    On Wed, Dec 26, 2012 at 3:02 AM, Roland Warmerdam
    notifications@github.comwrote:

    That won't work, you have to use the git submodule command. Read through
    the Submodules documentationhttp://git-scm.com/book/en/Git-Tools-Submodules
    .


    Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-11679355.

add comment via GitHub