How to configure multiple git RSA issues on a single machine
Many times, we use multiple git libraries on a single machine, such as GitHub, CSDN, and our own company. Then RSA is going to have multiple copies. So how do we make these things work together?
The principle is: Build multiple different RSA and then separate configuration in SSH config.
Step 1: Establish RSA
ssh-keygen -t rsa -C "你的邮箱地址"
After executing this command, the following prompt pops up:
Enter file in which to save the key (/Users/aaaa/.ssh/id_rsa):
Here is where "build multiple different RSA" files, enter a different name, will produce different RSA. For example, enter: Csdn_rsa. The Csdn_rsa is produced.
Repeat the above command, then build the Git hub.
2 modifying SSH config
Now, both the csdn and the Git hub have their own RSA. So, how to guide the selection of different RSA authentication. The SSH config file needs to be modified.
If your ~/.ssh directory does not have please create a file like this, file name: CONFIG.
The following thing is to modify the config file. Modify as follows.
Host github.comUser 你的名字IdentityFile ~/.ssh/id_rsaHost code.csdn.netUser 你的名字IdentityFile ~/.ssh/csdn_rsa
This makes it enjoyable to use multiple RSA.
How to configure multiple git RSA on a single machine