Let‘s talk about how to setup a github page.
This is my method :
-
Register inGitHub.
-
Create a repository。
The name of the repository should be same as your user name.
-
Install git in your PC.
then config your name and email:
$ git config --global user.name "Jasmine" $ git config --global user.email "123456@qq.com"
-
Create a SSH Key,and config it to GitHub.
-
Run ssh-keygen in your PC.
Please use your own email:
$ ssh-keygen -t rsa -C “123456@qq.com”
2. Config the key to GitHub. ![创建SSH密钥](//jasmine617.github.io/post/images/20211123003.png) ![配置密钥](//jasmine617.github.io/post/images/20211123004.png)
-
-
Clone the repository from GitHub.
-
Get the URL of your repository:
-
Create a folder in your PC, then open the Git Bash and excute.
Please use your own URL:
$ git clone git@github.com:Jasmine617/jasmine617.github.io.git Cloning into 'jasmine617.github.io'... warning: You appear to have cloned an empty repository.
or:
$ git clone https://github.com/Jasmine617/jasmine617.github.io.git
-
-
Create index.html and commit to git in your PC.
-
After clone, you will fine a new folder. Enter, then Create index.html,
This is a example:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>my first blog</title> </head> <body> <p>hello world</p> </body> </html>
-
Commit the file in Git Bash.
$ cd jasmine617.github.io $ git add --all $ git commit -m "test commit index.html"
-
-
Pull the file to your GitHub repository.
-
check your git status.
$ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
-
pull it to your GitHub repository.
$ git push origin main Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 338 bytes | 338.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/Jasmine617/jasmine617.github.io.git * [new branch] main -> main
-
-
Check your GitHub Page。
-
Check whether the index.html is in repository.
-
Check the GitHub Page Configuration.
-
Open your GitHub Pages.
-