Git Product home page Git Product logo

blog's People

Contributors

smallk2010 avatar

Watchers

 avatar

blog's Issues

Mac Sourcetree解决[email protected]: Permission denied (publickey)

电脑上打开终端输入:(7步)

  1. cd ~/.ssh

  2. 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
    然后出现输入密码直接回车到结束。

  3. 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,理论上应该正常了。

  4. ssh-agent -s
    添加共享库提供的钥匙。可以跳过。

  5. ssh-add ~/.ssh/id_rsa
    id_rsa如果重命名了,换成你起的名字。基本操作完成。这一步很重要,是把密钥缓存起来的。

  6. open . 进入目录打开刚刚生成的id_rsa.pub文件,然后复制里面的内容,进入你的github账号,在Settings下,SSH and GPG keys下new SSH key,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。

  7. 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.pubssh-add -D删除密钥,然后通过ssh-add ~/.ssh/id_rsa启用,本文中id_rsa是默认名字,重命名了别忘了改成你起的名字。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.