惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
D
Docker
云风的 BLOG
云风的 BLOG
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
G
Google Developers Blog
GbyAI
GbyAI
T
Tailwind CSS Blog
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
C
Check Point Blog
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
N
Netflix TechBlog - Medium
B
Blog RSS Feed
腾讯CDC
aimingoo的专栏
aimingoo的专栏

/home/hexchain

在 Linux 上使用 Docker 和 Java 开发酷 Q 插件 跨架构升级 Fedora 使用 networkd 管理 HE.net TunnelBroker LaTeX 笔记 OpenWrt 编译配置笔记 tar 分卷压缩与解压缩 Linux 上使用财付通控件
为不同 GitHub repo 使用不同 ssh key
hexchain · 2013-11-21 · via /home/hexchain

最近在折腾 mirrors 的时候发现 scripts 和 web 两个不同的仓库不能有同一个 ssh identity,于是就在服务器上生成了两个 ssh key,稍微修改了下配置文件,使得两个 repo 在 push 的时候能使用对应的 identity。

两个 identity 分别命名为 id_rsa_scripts 和 id_rsa_web ,存储在 ~/.ssh/ 目录下。

~/.ssh/config

Host github-repo-scripts
    Hostname github.com
    IdentityFile ~/.ssh/id_rsa_scripts

Host github-repo-web
    Hostname github.com
    IdentityFile ~/.ssh/id_rsa_web

~/scripts/.git/config 修改 [remote "origin"] 下 url 一项的值:

url = git@github-repo-scripts:UniqueStudio/mirrors-script.git

~/mirrorweb/.git/config 修改 [remote "origin"] 下 url 一项的值:

url = git@github-repo-web:UniqueStudio/mirrors-web.git