git多账号配置
多git账号配置
- 针对多个git分别生成公私秘钥
- ssh-keygen -t rsa -C aa@git.com
- ssh-keygen -t rsa -C bb@git.com
- 将上述生成的公钥拷贝到对应git地址内的ssh key
- vim ~/.ssh/config
Host github.com HostName github.com User aa IdentityFile /home/xxx/.ssh/aa_id_rsa Host gitlab.com HostName git.xxx.com User bb IdentityFile /home/xxx/.ssh/bb_id_rsa