ssh & hexo 使用速查表

213 阅读1分钟

ssh 方面

eval ssh-agent -s
ssh-keygen -t rsa -C "your_email@example.com"  # 生成rsa公私钥并存储在指定位置
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"  # 生成4096位的rsa公私钥并存储在指定位置,默认2048位
Enter file in which to save the key (/Users/you/.ssh/id_rsa): /Users/you/.ssh/id_rsa_coding  # 必须是从根目录开始的完整的路径加文件名
ssh-add  # 查看已添到ssh-agent的私钥
ssh-add  # 默认添加:id_rsa
ssh-add -A  # 默认添加:id_rsa
ssh-add -K ~/.ssh/id_rsa_coding  # 指定添加
ssh-add -D  # 全部删除
ssh-add -d  ~/.ssh/id_rsa_coding  # 指定删除
ssh -T git@git.coding.net # 测试
Ssh -T git@github.com  # 测试

hexo中的配置

deploy:
  - type: git
    repo: 
      github: git@github.com:dfface/dfface.github.io.git,master
      coding: git@git.dev.tencent.com:dfface/dfface.git,master

hexo 方面

hexo new [layout] <title>  // 创建一篇新文章
hexo generate   // 生成静态文件
hexo server  // 启动服务器
hexo server -p 5000
hexo deploy  //  一键部署
hexo g -d  // 在生成完毕后自动部署网
hexo d -g  // 在生成完毕后自动部署网

配置

资源文件夹

_config.yml
post_asset_folder: true

在你每一次通过 hexo new [layout] <title> 命令创建新文章时自动创建一个文件夹。这个资源文件夹将会有与这个 markdown 文件一样的名字。

{% asset_path slug %}
{% asset_img slug [title] %}
{% asset_link slug [title] %}
{% asset_img example.jpg This is an example image %}