demand background
1. The company uses https://www.atlassian.com/ the company's bitbucket product as a git remote warehouse.
2. Usually, I need to use the git repositories of the two public platforms, gitee.com and github.com, to learn some open source projects.
In usessh
-keygen -t rsa -C
"[email protected]"创建公钥私钥的时候,会覆盖掉之前创建的。
need
How to use the same computer to manage the ssh-keys of multiple git remote warehouse platforms?
I checked some information on the Internet and found that I can create a new config file.
The method is as follows:
The first step, usessh
-keygen -t rsa -C
"[email protected]"创建公钥私钥时,不同的git仓库平台使用不能的文件名。
For example, on the github platform, I named the file names: id_rsa_github and id_rsa_github.pub (the default files are id_rsa and id_rsa.pub),
For example, on the gitee platform, I named the file names: id_rsa_gitee and id_rsa_gitee.pub,
The company's git repository, I named the files: id_rsa_infinitus and id_rsa_infinitus.pub, (infinitus is the English code of my company)
The screenshot effect is as follows: (The files are placed in the .ssh directory of the C drive user directory by default)
The second step is to create a new config file and configure the following contents.
# Configure git.infinitus.com.cn Host git.infinitus.com.cn HostName git.infinitus.com.cn IdentityFile C:\\Users\\xi.yang\\.ssh\\id_rsa_infinitus PreferredAuthentications publickey User [email protected] # Configure github.com Host github.com HostName github.com IdentityFile C:\\Users\\xi.yang\\.ssh\\id_rsa_github PreferredAuthentications publickey User [email protected] # Configure gitee.com Host gitee.com HostName gitee.com IdentityFile C:\\Users\\xi.yang\\.ssh\\id_rsa_gitee PreferredAuthentications publickey User [email protected]
Screenshot below:
Then you can freely use the git repositories of these three platforms on your computer.