Forking and modifying an existing
Jekyll template is one of the easiest ways to build GitHub blogs. But if you prefer some adventure and want to experiment eveything from scratch then this post is for you! To create a blog on GitHub at first you need a
GitHub account. After log in to your account you will see a panel on the left to create a repository. Create a new repository and name it
your_user_name.github.io. When creating the repository make it public, you may skip Initialize the repository with a ReadMe file, choose a licence of your preference. After creating the repository you will get the address of the repository similar to
https://github.com/your_user_name/your_user_name.github.io.git. Use the
git tool to clone the repository to your own machine.
$git clone https://github.com/username/username.github.io
Now download and install the
Jekyll tool. This tool will mainly build your website. It has noting to do with GitHub. Open the
Windows command prompt and check the Jekyll version to ensure it has been installed successfully.
jekyll -v
Now set the path of the command prompt to your cloned repository
your_user_name.github.io.git and give the following
command. The dot (.) here is part of the command.
jekyll new .
if you have pre-existing files in your repository then
jekyll new . --force
It will create the structure of your website. Jekyll can help you to see the website on your localhost. Run the following command on Windows command prompt.
jekyll serve
If it doesn't work then try the following command.
bundle exec jekyll serve
It will generate a server address (http://). Copy-paste that to your browser. Your Blog is ready. Congratulations!Now you can go online pushing your site to your GitHub account. Use the Git bash to give the following command on you project directory
$git add --all $git commit -m "Initial Commit" $git push -u origin master
Now go to to your GitHub repository (refresh if it is already open). It should show the uploaded project in the master branch. Go to the
Settings of your repository. Under the
GitHub Pages section select a
Source branch (for example the master branch). The page will refresh and you will find the link of your website. If it's showing
Your site is ready to be published at http:// then wait a while and refresh your page. It will change to
Your site is published at http://.Your blog is online now, but it's holding only the default contents. You can customize it in your own way. One starting point is
_config.yml. To publish your blog content modify following the format of the post given as an example inside the directory
_posts. The link to your post will appear automatically in your Front matter.You can customize your blog directly on GitHub or on your local machine. If you work on your local machine you can use
VSC (Visual Studio Code) ( or a text editor will also do). After modifying your code, save it and check the website using Jekyll on your own machine
jekyll serve
If Jekyll is already running simply refresh the page. If the contents of the page doesn't change even after refreshing then stop Jekyll and try
bundle exec jekyll clean jekyll serve
When satisfied commit the changes using git bash and push it to your GitHub account.