2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
If you have previously setTortoiseGitCheck it in the software, as shown in the figure:
You can use the following command to clear the global settings [recommended]:
git config --global --unset user.name "你的名字"
git config --global --unset user.email "你的邮箱"
For example:
git config --global --unset user.name "qiandu"
git config --global --unset user.email "[email protected]"
Or with the help ofTortoiseGit:
Check whether the clearing is successful
git config --global --list
If user and email do not appear, it means the global settings have been cleared successfully!
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"
For example:
git config --global user.name "qiandu"
git config --global user.email "[email protected]"
or
Please change the email address to your own!
ssh-keygen -t rsa -C '[email protected]' -f ~/.ssh/gitee_id_rsa
ssh-keygen -t rsa -C '[email protected]' -f ~/.ssh/github_id_rsa
Note that after entering the command to generate the SSH-key, you need to press Enter three times, which means empty, that is, "empty" means there is no password.
Create a new config file in the ~/.ssh directory [C:UsersUsername.ssh] and add the following content (Host and HostName are filled with the domain name of the git server, and IdentityFile specifies the path of the private key)
# github
Host github.com
HostName github.com
User git
Port 443
IdentityFile ~/.ssh/github_id_rsa
# gitee
Host gitee.com
HostName gitee.com
User git
Port 22
IdentityFile ~/.ssh/gitee_id_rsa
ssh-add ~/.ssh/gitee_id_rsa
ssh-add ~/.ssh/github_id_rsa
Confirm that the ssh-agent process is running: Run eval $(ssh-agent) to start or restart the authentication agent.
eval $(ssh-agent)
After adding, you can verify it by executing the following code.
ssh-add -l
Gitee public key:gitee_id_rsa.pub
GitHub public key:github_id_rsa.pub
ssh -T [email protected]
ssh -T [email protected]