【Git】Mac环境下配置Git并生成SSH公钥

1.  先在APP Store里面下载Git

2. 创建ssh key

ssh-keygen -t rsa -C "@qq.com"

 三次回车后显示:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/wangwenzhuo/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/wangwenzhuo/.ssh/id_rsa.
Your public key has been saved in /Users/wangwenzhuo/.ssh/id_rsa.pub.

3.检查电脑是否已创建了公钥和私钥

cd ~/.ssh
ls

结果显示已创建:

id_rsa		id_rsa.pub	known_hosts

4.获取自己的公钥

cat id_rsa.pub

结果显示自己的公钥(我只截出来了一部分):

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1JaQPGvmiVVSLD9JP9wv9u9MeidWqL5gODO3LpKGnKZxV2W5A7q6rIYEDaN3tDG7gi4veEiKen7gVKOqI4tWNkIFkrXqfDCv

你可能感兴趣的:(工具,git,ssh,macos)