Configure github's ssh under mac computer

created at 08-07-2021 views: 2

Step1: Verify whether there are ssh keys

ls -al ~/.ssh

See if there is already a file ending with .pub in the returned result

1.1: If there is a file ending with .pub, open it directly

cat ~/.ssh/

Copy to SSH keys on github

1.2: If not, skip to Step2

Step2: Create new ssh keys

Generate ssh-keygen

ssh-keygen -t rsa -b 4096 -C ""

Among them, is the mailbox associated with your github;

Determine the directory where the key is saved (press Enter directly, select the default)

 select the default

Enter the password

  • you can press Enter directly if no password is required
  • and you set a password if you want

At this time, two files are generated in the default path, the public key and the private key.

Add SSH Key to ssh-agent

eval $(ssh-agent -s)

Return the Pid of the agent

Agent pid 1766
ssh-add ~/.ssh/id_rsa

Then enter the password, if there is no password, press Enter, prompting that the addition is successful

Open the file and copy the content of the file to github

# check directory
ls -al ~/.ssh
# open the file
cat ~/.ssh/

Step3: Verify whether github is linked

ssh -T

In this way, github's ssh can be linked to mac, and the code can be uploaded and downloaded~~

created at:08-07-2021
edited at: 08-07-2021: