Why doesn't my SSH key work for connecting to github?

后端 未结 9 1219
-上瘾入骨i
-上瘾入骨i 2021-01-30 02:19

Note: I\'m not a newb, and I\'ve done this a gazillion times, but for some reason today it decided not to work.

I keep getting the Permission denied (publickey).

9条回答
  •  既然无缘
    2021-01-30 02:44

    First, try this (changing your email address as needed)

     ssh-keygen -t rsa -b 4096 -C "you@yourdomain.com"
    

    If you're creating using Cygwin, there might be confusion about the home directory, which is what happened for me, as I was referring to (copying to GitHub) an old/incorrect key from a different directory. So in case this happens for you, after creating the key, do:

    $ explorer .
    

    Which will pop up a windows explorer window, showing your full/absolute path. That's when I saw the ~ directory was actually my Cygwin directory

    C:\Program Files\cygwin64\home\{your_username}\.ssh
    

    I was then able to copy my private SSH key and paste in GitHub, and cloning, etc.. then worked.

提交回复
热议问题