1.首先需要创建公钥,在命令行中输入:
ssh-keygen -t rsa -C "sen@xin"
然后输入路径,密码之类的,如果不输入,工程就会保存到根目录下面,密码也为空。
/.ssh/id_rsa是私钥,/.ssh/id_rsa.pub是公钥
2.接着打开公钥:
cat ~/.ssh/id_rsa.pub
这里会得到一段很长的编码:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYZIchz3THIcc/wH0ZB5WZYqe2iBVUNqSzfrgxBvJCZkFHWiUZhA/4omNud/27PVT/FADV9qSvrX7ifP05Cbl6mhE4uJjxOQRNoPdQQcsTEFh5vDvOeiJOT1CoFb9WLGg49Xml4yJmFJqv/Kz5hCe7LEWRYJH6tmaVG0qi9nwAZmjfTQpSWu07eAKB9wAbK6stCdnd5JvMq7IsNNylbwDlXf0RQA4RpppO+14oNBqivhi5ftBPjP15+aWKpnXUxkGMVAefKTvwsyw1T0H2sj+ILVFM4d5xpxu3jPHebqh363OwPPLMsoUy9VhQ3YDtMxt4vyOxvpJ9ekMGlDn/9ut 626512443@qq.com