按如下命令来生成 sshkey:

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

按照提示完成三次回车(设置密码为空),即可生成 ssh key;

添加后,在终端(Terminal)中输入:

ssh -T git@gitee.com

若返回 :

Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access.

则证明添加成功。

将公钥添加到git服务器;(例如:github; gitee; …)
划重点: 执行ssh-add -K ~/.ssh/id_rsa 将sshkey添加到钥匙串;

Host ‘git服务器的域名’
HostName ‘git服务器的域名’
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa(私钥的路径)

如coding

Host conding.com
HostName e.coding.net
IdentityFile ~/.ssh/id_rsa_coding

 

相关文章:

  • 2021-07-20
  • 2021-10-21
  • 2021-12-10
  • 2021-07-25
  • 2021-12-14
猜你喜欢
  • 2021-05-18
  • 2021-08-01
  • 2021-12-19
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案