部署 Deploy >1 apps on 1 server [小技巧]

geektony · October 19, 2014 · 1279 hits

思路

  • Issue 1 个 ssh-key 只能用于一个帐号

  • Solution 创建多个 ssh-key,在不同项目 deploy 时,通过 Host 匹配不同项目

步骤

Step 1

application_name = '项目名称'
github_user_name = 'Gihub 的用户名称'
ssh-keygen -t rsa -C deploy@application_name

Step 2

创建 key 文件

~/.ssh/id_rsa_application_name

Step 3

把 id_rsa_项目名称.pub 的 key 复制到 github setting deploy key

Step 4

创建 .ssh/config

Host github.com-application_name
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_application_name

Step 5

然后把 deploy 里面的 repo_url 设定为新的

set :repo_url, 'github.com-application_name:github_user_name/application_name.git'
No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.