Part 2: Deploy to GitHub
In the upper-right corner of any page, click +, and then click New repository.
Enter name for your blog project, which must be following this pattern: <username>.github.io
Click Create repository.
Congratulations! You’ve successfully created your blog repository!
Open Git Bash if you are using Windows, or open simply Terminal if you are using Linux or Mac.
set your username and email
git config --global user.name "YourName"
git config --global user.email "YourEmail@Address"
Generate SSH key
ssh-keygen -t rsa -C "YourEmail@Address"
Then it will show some lines on the screen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
Simply continue. After this, the system will ask for a passphrase. You may leave it blank if you like.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
- Add your public key on GitHub
Now you should have a hidden directory in your home directory named “.ssh”, whichin this hidden directory, two files should be generated with some string similar to “id_rsa” and “id_rsa.pub”. The second one is what we need to copy to GitHub.
So log in to your account on GitHub, click on the gear-shaped button on the upper-right corner, which will bring you to the setting page. Now find “SSH Keys” on the left hand-side menu, and click on “Add SSH Key”.
Now open the the “id_rsa.pub” file we mentioned before with any text editor you like, copy all the content within, and paste it in the textbox on the webpage. Confirm the change.
Enter the following commands in Terminal:
$ ssh -T firstname.lastname@example.org
When you will see something as below, input “yes”, and enter.
The authenticity of host ‘github.com (18.104.22.168)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
You may find your blog settings in file “_config.yml”. There are only two places you need to change at this stage:
Title of your blog
In the very beginning of this file, you can change the title and subtitle to whatever you like.
subtitle: Geeks never think alike.
description: Yizhe's blog
author: Yizhe Wang
In the very ending of this file, you need to change the repository_url to the repository you created on GitHub. In my example, it should be “email@example.com:wangyiz4262/wangyiz4262.github.io.git”. And branch should be master.
github: <repository url>,[branch]
If you have a domain name of your own, you can bind it to your blog. Please find tutorials online.
Now the deployment is done. Enjoy blogging!