smallk2010 / blog Goto Github PK
View Code? Open in Web Editor NEW展示自己,沟通外界。欢迎关注,一起分享。如有雷同,实属巧合。
展示自己,沟通外界。欢迎关注,一起分享。如有雷同,实属巧合。
电脑上打开终端输入:(7步)
cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
[email protected]为自己的邮箱,这里的"[email protected]"并非必须写邮箱地址,而是一个注释,邮箱仅仅是识别用的key,当你创建ssh的时候,密钥的类型,用于识别这个密钥的注释,所以这个注释你可以输入任何内容,很多网站和软件用这个注释作为密钥的名字。
然后回车,出现Enter file in which to save the key (/Users/cc/.ssh/id_rsa):
如果想重命名,就输入你喜欢的名字,回车,出现Overwrite (y/n)? 输入y,否则默认回车,后面生成的文件 就是喊id_rsa
然后出现输入密码直接回车到结束。
ssh -v [email protected]
可以跳过。显示详细的调试信息,如果ssh连不上可以使用这个参数看看哪一步出问题了。会看到最后2句是
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).
如果显示不是这两句,请检查信息。看到有“Hi **! You've successfully authenticated....”一般情况可能是你本地已经创建过其他密钥了。可以通过输入 ssh-add -d ~/.ssh/id_rsa.pub从缓存中删除,非删除本地文件哦,否则无效。然后再执行3,理论上应该正常了。
ssh-agent -s
添加共享库提供的钥匙。可以跳过。
ssh-add ~/.ssh/id_rsa
id_rsa如果重命名了,换成你起的名字。基本操作完成。这一步很重要,是把密钥缓存起来的。
open .
进入目录打开刚刚生成的id_rsa.pub文件,然后复制里面的内容,进入你的github账号,在Settings下,SSH and GPG keys下new SSH key,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。
ssh -T [email protected]
然后你会看到 Hi **! You've successfully authenticated, but GitHub does not provide shell access.
总结:可以通过ssh-add -l
查看缓存中的密钥列表,然后ssh-add -d ~/.ssh/id_rsa.pub
或ssh-add -D
删除密钥,然后通过ssh-add ~/.ssh/id_rsa
启用,本文中id_rsa是默认名字,重命名了别忘了改成你起的名字。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.