跳转到内容

欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。

Git:配置多个SSH证书

来自WHY42
Riguz​(留言 | 贡献)2021年4月9日 (五) 14:53的版本 (建立內容為「为多个不同的git repository配置不同的SSH key: ~/.ssh/config <syntaxhighlight lang="lua"> Host github.com HostName github.com User git Id…」的新頁面)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

为多个不同的git repository配置不同的SSH key:

~/.ssh/config

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519

Host github.com-xxx
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa

然后需要将repository的地址进行替换:

git remote set-url origin git@github.com-xxx:XXX/XXXX.git