0%

BLOGS - Manage double Github Accounts and Build up my UST Blogs

Welcome to TianyaoBlogs! This is my very first post. It has shown my process of building blogs!

Start to own your blogs

Download NodeJS & npm and check its version

1
$ node -v
1
$ npm -v

More info: Download More info: Download

Prepare your path

1
2
$ npm config set prefix "D:\Program Files (x86)\node_modules\node_global"
$ npm config set cache "D:\Program Files (x86)\node_modules\node_cache"

More info: Check

Check your environmental path

1
$ echo %NODE_PATH%

More info: Check

Generate SSH keys for the second account (For those people who have two or more github account)

1
$ ssh-keygen -t ed25519 -C "your_email@second_account.com"

Add the new public key to the second GitHub account

1
$   cat ~/.ssh/id_ed25519_second.pub

Configuring SSH multi-account rules

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$    cnano ~/.ssh/config
$ # (peninsula824)
$ Host github.com-peninsula
$ HostName github.com
$ User git
$ IdentityFile ~/.ssh/id_rsa # peninsula824_key
$ IdentitiesOnly yes

$ # (TianyaoBlogs)
$ Host github.com-tianyao
$ HostName github.com
$ User git
$ IdentityFile ~/.ssh/0901102262 # TianyaoBlogs_key
$ IdentitiesOnly yes

Test the connection

1
2
$   ssh -T git@github.com-peninsula
$ ssh -T git@github.com-tianyao

Update Hexo deployment configuration

1
2
3
4
5
$   deploy:
$ type: git
$ repo:
$ github: git@github.com-tianyao:TianyaoBlogs/TianyaoBlogs.github.io.git
$ branch: main

Complete the deployment

1
2
3
$   hexo clean
$ hexo generate
$ hexo deploy

Push new blog

1
$   hexo g -d