“Key is invalid” message on GitHub

后端 未结 18 2021
爱一瞬间的悲伤
爱一瞬间的悲伤 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: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 :)

    0 讨论(0)
  • 2021-01-30 02:53

    Recommended by GitHub

    Copying the SSH-KEY :

    I worked with xclip to copy the id_rsa.pub key, like so:

    1. Install xclip

    sudo apt-get install xclip

    2. Copy with xclip

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


    Good Luck.

    0 讨论(0)
  • 2021-01-30 02:54

    To Copy the entire content of id_rsa.pub to clipboard:

    Run > pbcopy ~/.ssh/id_rsa.pub

    0 讨论(0)
  • 2021-01-30 02:55

    If you are using bash for windows as your terminal and you are copying via shift + highlighting + ctrl-c, then this solution might work for you:

    1. After copying the key and pasting it into notepad:

    1. Now go to Edit > Select All or Ctrl-A

    1. The large amounts of blue areas are whitespace. You need to delete them with either the backspace or the delete key. Leave the whitespace that in the green circles.

    1. You should now be able to copy and paste this edited version into github.

    0 讨论(0)
  • 2021-01-30 02:55

    It's common issue we face while generating the key. While the SSH generating, we will get two diff files one is id_rsa and id_rsa.pub. here the file with pub extension is the public key holder file. You must copy the content from this file and add to the Github.

    NOTES: 1. public key file content starts with 'SSH-RSA' 2. end with your Github email id. ex: if you registered Github with @gmail.com then the pub file has the specified email id at the last

    0 讨论(0)
  • 2021-01-30 02:56

    I try several ways, but none of them helps(my os is ubuntu). Then I thought if I can print the content of ~/.ssh/id_rsa.pub by using command "more".

    I sorry than I have no reputation to post images! when i have, i will post it!

    Here is a url where you can see the image:

    enter image description here

    I copied the content from the command line, and it WORKED!!!

    0 讨论(0)
提交回复
热议问题