“Key is invalid” message on GitHub

后端 未结 18 2022
爱一瞬间的悲伤
爱一瞬间的悲伤 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条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 02:52

    I know this is question is a cpl years old now, but if someone in 2018 encounter this:

    then below is a no-brainer:

    my problem was I tried to copy the private key

    id_rsa

    instead of public key content

    id_rsa.pub

    as my SSH gitlab repository key, so after you:

    ssh-keygen -t rsa -C "your@email.com" -b 4096
    

    please remember about the .pub file extension to copy from:

    • OSX:

      pbcopy < ~/.ssh/id_rsa.pub

    • Linux:

      xclip -sel clip < ~/.ssh/id_rsa.pub

    • Windows PowerShell

      cat ~/.ssh/id_rsa.pub | clip


    then paste it to your gitlab/github or other repository as your SSH key

    this makes perfect sense, because you should always only share your public key, not the private one :)

提交回复
热议问题