配置密钥

安装hexo依赖

1
1 npm install hexo-deployer-git --save

Git配置

在blog文件夹下打开git输入

1
1git config --global user.email"注册github时使用的邮箱"2 git config --global user.name"github的用户名"

生成git公钥

1
1 ssh-keygen -t rsa -C "you email@126.com"

提示输入passphrase时可直接回车

使用记事本打开id_rsa.pub复制内容文件在C:\Users\你的用户名\.ssh目录下

进入github登录点击头像SettingsSSHand GPG keysNewSSHkey在Title中输入hexo博客在key的文本框中输入复制的内容Add SSH key

在Git Bash中输入

1
1 ssh -T git@github.com

出现Hi用户名!You’ve successfully authenticated,but GitHub does not provide shell access。则证明成功!

打开_config.yml进行修改
补全如下代码repo即你的仓库https地址

1
2
3
4
1deploy:
2type:git
3repo:git@github.com:your_name/your_name.github.io.git
4branch:main