月下影成双

Like the meeting of the seagulls and the waves we meet and come near. The seagulls fly off and the waves roll away we depart.

Git 多用户配置

2023-08-13 需要 5 分钟阅读 技术 澜长生

密钥

  • 生成密钥
ssh-keygen -t rsa -C "EMail"s
(base) [15:55:07] [~] ❱❱❱ ssh-keygen -t rsa -C "youremail@gmail.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/home/snoer/.ssh/id_rsa):

  • 在 github 设置中添加密钥
cat  name_rsa.pub

config文件

  • 找到 .ssh文件夹, 添加config文件
cd /home/user_name/.ssh/
vim config
  • 文件内容
Host aeron
  HostName github.com
  User aeron
  IdentityFile ~/.ssh/aeron_rsa

Host snoer
  HostName github.com
  User snoer
  IdentityFile ~/.ssh/snoer_rsa

  • 参数说明
  1. Host

主机别名, 可以自定义.

  1. HostName

服务器真实地址

  1. User

用户名, 随意.

  1. IdentityFile

私钥文件路径

  1. PreferredAuthentications

认证方式, 可不填写


  • 配置检查
ssh -T git@aeron