Git generates public key and view public key

1. After installing git, right-click gitbash here in the specified directory
insert image description here
to pop up the command line window:
insert image description here
2. Configure the local user name and mailbox

# 配置用户名
git config --global user.name "用户名"
# 配置邮箱
git config --global user.email "邮箱地址"

After the above command is executed, you can use the git config --global --list command to check whether the configuration is successful
3. Git generates the public key
1) Enter the following command in the git bash window to generate the annotated public key

ssh-keygen -t rsa -C '邮箱地址'

2) Set the location where the public key is stored. By default, press the Enter key to confirm.
3) Enter the password and confirm the password. If you do not set a password, press the Enter key directly.

4. How to view ssh public key with git
1) Through the git bash command window
① directly enter cat ~/.ssh/id_rsa.pub to view
insert image description here
② Step by step enter the directory to open the file
a. Enter the .ssh directory: cd ~/.ssh
b .Find the id_rsa.pub file: ls
c. View the public key: cat id_rsa.pub or vim id_rsa.pub

2) Directly open the .ssh folder under the user directory, and open the id_rsa.pub file inside to view

Guess you like

Origin blog.csdn.net/xiaowanzi_zj/article/details/127352410