Git ssh configuration in Mac

1. Check whether it has been configured

1.cd ~/.ssh -> enter the ssh directory

If you cannot enter the directory, it means that it has not been generated, you need to use command 2 to check the configuration

2. git config --list -> Check whether the git account has been configured

3. ls -> View ssh specific content

If there are id_rsa and id_rsa.pub in the ssh folder, it means that the ssh key has been generated before and can be used directly

 cat id_rsa.pub -> view the public key , copy all, add to github

2. Reconfigure

Reconfiguration also needs to be done in the terminal:

1. Configure account

git config --global user.name "account name" -> user name, pinyin or English is recommended

git config --global user.email "account email" -> email address

2. Generate a secret key 

ssh -keygen -t rsa -C "account email" -> above email address

Press enter 3 times in a row until the screenshot below appears

After steps 1 and 2, the account creation and secret key generation are completed. There are more id_rsa (private secret key) and id_rsa.pub (public key) in the .ssh folder. The next step is to check

3. cat id_rsa.pub -> view the public key , copy all, add to github

Guess you like

Origin blog.csdn.net/awei970512/article/details/127029596