<h6>1、在终端下生成SSHKey</h6>
<li>ssh-keygen -t rsa -C "你的邮箱" </li>
<p>出现提示</p>
<p>Generating public/private rsa key pair.
Enter file in which to save the key (/Users/wei942/.ssh/id_rsa): </p>
<h6>2、直接回车,保存密钥对保存到默认位置/Users/你的Mac用户名/.ssh/id_rsa</h6>
<p>出现提示</p>
<p>Enter passphrase (empty for no passphrase):</p>
<h6>3、输入密码密钥对的密码,一般不设置,直接回车,再次回车</h6>
<p>出现提示</p>
<p>Your identification has been saved in /Users/wei942/.ssh/id_rsa.
Your public key has been saved in /Users/wei942/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:GGdJBO5EIhN7pPft8fsytBvD4WrJCCfmVEnOYbrHOOQ September@wangrongxingdeMac-mini.local
The key's randomart image is:
+---[RSA 2048]----+
| +.o ooo |
| * ++. . |
| o o+o+ |
| oo+= |
| o =+ S . |
| E +. =.. |
| + * o.o*. |
| . . +.++ |
| .. o=. |
+----[SHA256]-----+
</p>
<h6>4.查看公钥</h6>
<li>cat ~/.ssh/id_rsa.pub</li>
<p>出现提示</p>
<p>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhh2S2F+13yo2KHvLFryn0mRzOVYT1mi2I6rhl45FQ3AcPXgypSuDgKuwVbOu92a+YzA2eXxcUU6qsQG8z1HRchKysSnrbSrj60CfHhsTTfg+vnZVVPjnc+OgUxUtcpQBMg/IyG7ya1c3sDNfToAi7xmu/07yAITot3kEzwctnsi7aCT944t15uoRz8/NokZBGVaqMo9vJj5rSlwzBRdS+gQZJ1gqamcaoLh6/3tHrQ1MYl1jey4kOkvfwyCtUpKDS28GMuO3t2BDhuzBqlpj8SO262pbZ3F3w3lu3Oimjh8M+pU9HMfUIo1zqCvE07XT8t4RVbPxfWSFSPGYG9DL September@wangrongxingdeMac-mini.local</p>
<h6>4.拷贝公钥,添加到你的账号中</h6>
<h6>6.连接到码云</h6>
<li>ssh -T git@git.oschina.net</li>
<p>出现提示
Welcome to Git@OSC, Wei942!</p>
<h1>恭喜你成功了</h1>
<h3>终端图解</h3> Artboard.png
网友评论