Skip to content

Instantly share code, notes, and snippets.

@TylerFisher
Last active April 22, 2024 09:45
Show Gist options
  • Save TylerFisher/6127328 to your computer and use it in GitHub Desktop.
Save TylerFisher/6127328 to your computer and use it in GitHub Desktop.
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either GitHub for Mac or GitHub for Windows, depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level directory.
  6. Back in the GitHub application, you should see your files in the left column. Make sure they are all checked. If so, enter a message in the text box called "commit summary", something like "initial commit." Then, click the commit button.
  7. Click the "Publish repo" button in the top right corner.
  8. Give it about 10 minutes, then check your-username.github.io. Your website should be there!

Using a custom domain name

You can just leave your website at that address (it'll give you some serious street cred in the developer world), but if you have a custom domain you would like to use, it is very simple to make GitHub redirect your page.

  1. Log in to your domain registrar and find where to change your host records. If you don't know, you can usually Google "(domain registrar) change host records", and your registrar will have an explainer telling you how to do it.
  2. Change your domain's A Record to 204.232.175.78. This is GitHub's IP address, which allows GitHub to resolve your URL and serve the correct files.
  3. In your website's directory folder on your computer, create a file called "CNAME". On the first line, type your domain name. Save the file.
  4. In your GitHub application, you should see the file in the left column. Make sure it is checked and enter your commit message. Have it say something like "Adding CNAME file."
  5. Click "Sync branches."

It can take as long as 48 hours for your domain to resolve to your GitHub page. However, it is usually pretty quick, so check back in an hour or so.

@oktaviannikky
Copy link

My website: https://oktaviannikky.github.io/
My repo site: https://github.com/TryHard-777/Oktaviannikky.github.io

your repository has Caps your website doesn't.

Already change the caps lock (if that what u mean), but still can not connect to my website.
When I tried looking for error in the action section, there is something like this:
image

What should I do, Please help

@Munyalo328
Copy link

How can I get the url for my repository?

@oktaviannikky
Copy link

How can I get the url for my repository?

if u mean ur webpage url then ur repo name is the url
image

but if u mean the repo link like "https://github.com/TryHard-777/Oktaviannikky.github.io"
u can just open ur repo then copy the url

@Hermon71type
Copy link

Can I just make web pages without JS
Im a beginner Web developer

@iEddyghost
Copy link

iEddyghost commented Oct 25, 2023 via email

@Mikdadali
Copy link

Mikdadali commented Feb 2, 2024

Hello,

https://github.com/Mikdadali/mikdadali.github.io
this is my repository how can i open my website please someone giude me...

Thanks

@totiard
Copy link

totiard commented Mar 29, 2024

apakah hanya bisa 1 website saya? bagaimana jika saya ingin membuat 2 website dengan url yang berbeda?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment