企业项目管理、ORK、研发管理与敏捷开发工具平台

网站首页 > 精选文章 正文

Git配置多个SSH-Key(git配置多个公钥)

wudianyun 2025-03-30 21:46:52 精选文章 19 ℃

1、生成一个给GitHub使用的sshkey

# 参数说明:
# -t dsa | ecdsa | ed25519 | rsa
# -C comment
# -f output_keyfile

ssh-keygen -t rsa -f ~/.ssh/github_id_rsa

2、在Windows系统的C:\Users\xxx用户\.ssh 或者 Linux系统的/root/.ssh目录下,创建config文件:

其中:Host和HostName为服务器的域名,IdentityFile为私钥的路径

# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa

3、使用ssh命令测试

ssh -T git@github.com


详见:

# 生成/添加SSH公钥:
https://gitee.com/help/articles/4181

# Git配置多个SSH-Key:
https://gitee.com/help/articles/4229

Tags:

最近发表
标签列表