“Key is invalid” message on GitHub

后端 未结 18 2237
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 01:49

I have generated SSH keys for a new server installation according to the procedure outlined here. However, when I copy the contents of id_rsa.pub to my keys list on

18条回答
  •  梦如初夏
    2021-01-30 02:47

    I was having the same issue, despite copying the public key from cat output directly from the terminal (Cmder/ConEmu). It seems that the method that you use to copy the public key seems to make a difference. Here is a way to check:

    $ ssh-keygen -l -f ~/.ssh/id_rsa.pub
    4096 SHA256:...
    

    Then paste the key that fails into a new file, and try to verify that:

    $ ssh-keygen -l -f test.pub
    test.pub is not a public key file.
    

    In my case I had been copying the key from terminal output using cat; instead getting the key from vim worked. Here is way to open the key in vim with word wrap enabled:

    $ vim "+set wrap" ~/.ssh/id_rsa.pub
    

    I suspect that the terminal emulator may have something to do with it as I haven't had this issue with Terminal.app.

提交回复
热议问题