每次hexo d都要输入密码太烦了
生成ssh密钥对
Linux系统:
1 | ssh-keygen -t rsa |
Windows可以使用Xshell生成秘钥对, 之后导入到 C:\Users\Username\.ssh
目录下
公钥命名为id_rsa.pub
, 私钥命名为id_rsa
github添加ssh公钥
方法一: 在个人profile里添加公钥
Your profile
-> SSH and GPG keys
-> New SSH key
-> 复制生成的公钥 ->
方法二: 项目的设置里面添加
Settings
-> Deploy keys
-> Add Deploy key
-> 复制公钥 -> 勾选Allow write access
-> Add new
设置远程git地址:
1 | cd blog/.deploy_git |
编辑配置文件_config.yml
, 将deploy
的https
协议改为使用git
协议:
vim _config.yml
1 | deploy: |
部署到github: hexo d -g