DEV Community

Cover image for Github Pages, the quick start.
Omarseda
Omarseda

Posted on

Github Pages, the quick start.

Just joined here, and as you know, one of the recommended tasks for a new member here is writing the first post. But I just don't have any important idea or things to write about. :D

But ok, here i'm going to try to write about creating your very first github page, in case you still don't have a github page, still don't know how to do it, or whatever, here the quick start.

First, go to the github, and make sure you are already logged in. If not, you'd better create a github account now.

Go to your profile page and create a repository named something like jack.github.io, where jack have to be exactly the same as your github username. So, for instance, if you are https://github.com/omarseda, then the repository name must be omarseda.github.io.

Now, we are going back to our local machine. (Oh, I forget, you must have a git installed on your machine too, if not, install it now.)

Now, somewhere on your local machine, open the terminal or git console and clone your repo, replace the jack with your username :

$ git clone https://github.com/jack/jack.github.io
Enter fullscreen mode Exit fullscreen mode

You have a cloned repository under jack.github.io directory, now. Go there and make a html file index.html :

$ cd jack.github.io
$ echo > index.html
Enter fullscreen mode Exit fullscreen mode

Open the index.html in your editor, and write some html, this will be your homepage of your github pages, example :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hello Github</title>
</head>
<body>
    <p>Hello World !</p>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Then save it.

Now we are going back to the git to add the file, then commit and push it :

$ git add index.html
$ git commit -m "Hello world"
$ git push -u origin master
Enter fullscreen mode Exit fullscreen mode

Done. Open your page at https://jack.github.io, on your browser.

You can edit your file again next times, add some other files, and when you're done, just add, commit and push it again.

Top comments (0)