git generates a secret key to switch to a new account

How to generate ssh key with git:

1.Set Git user name and email:

git config --global user.name “lval”

git config --global user.email “[email protected]

2. Check if you already have the ssh key: cd ~/.ssh

cat .ssh/id_rsa.pub

3. Generate key: ssh-keygen -t rsa -C "[email protected]"

4. Enter the password
Insert image description here
5. Find the generated key file
Insert image description here

6. Log in to your git account and copy the contents of the generated key file to the ssh key to generate a new key.
Insert image description here

Insert image description here
7. The account login is successful and you can use the git command to pull the code.

Guess you like

Origin blog.csdn.net/weixin_42215897/article/details/107635636