本地有多个github账号如何使用hexo部署到特定账号

step 1:

往这个github账号上添加本地的ssh 方法如下:

  • ssh-keygen -t rsa -C “your github email”
  • kd_rsa 为这个key命名,注意不要与本地已有的key重名,楼主在这里使用的kd_rsa这个名字
  • clip < ~/.ssh/yourPubFileName.pub Alt text 这样可以把yourPubFileName.pub里面的内容拷贝出来
  • github -> settings -> ssh and gpg keys -> new ssh key -> input your title -> paste your ssh -> add ssh key Alt text Alt text 多个账号就重复这一步骤

    step 2:

  • touch config 在~/.ssh路径下生成config文件 Alt text
  • 编辑config
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Host name1
    Hostname github.com
    User git
    IdentityFile ~/.ssh/yourKey1

    Host name2
    Hostname github.com
    User git
    IdentityFile ~/.ssh/yourKey2
    楼主的config文件如下: Alt text

    step 3:

  • 配置hexo repo: name1:name1/yourRepository Alt text
|