0

I am working on Linux console environment without GUI. I want to work with github.

After generating ssh key, I can see a very very long string from id_rsa.pub file. A serious problem for me: how to add this long string to github.com Account Settings/SSH keys ?

I don't want to type letters one by one from my Windows.

2
  • 1
    Are you using something like PuTTY to connect between the two? Commented May 6, 2014 at 11:52
  • @Leigh I have a Linux environment on Virtualbox. Commented May 7, 2014 at 3:57

3 Answers 3

3

You can add it using the GitHub API.

curl -u "USERNAME:PASSWORD" --data "{\"title\": \"TITLE\", \"key\": \"$(cat ~/.ssh/id_rsa.pub)\"}" https://api.github.com/user/keys

You'll need to replace:

  • USERNAME with your github's username

  • PASSWORD with your github's password

  • TITLE with the title you want for your key to be stored

  • "~/.ssh/id_rsa.pub" with yours ssh-key path (if different)

For more information, read: https://developer.github.com/v3/users/keys/

Sign up to request clarification or add additional context in comments.

Comments

1

I can think of two ways to do this:

1) Use GitHub's API to create the public key on your account.

2) Use another computer with a GUI to ssh into that Linux machine, grab the key, and use GitHub's website to add the public key to your account.

Comments

1

You can easily copy it out by SSHing into the Linux machine from the Windows side with PuTTY.

Once you're in:

  1. Show the contents of the file with cat ~/.ssh/id_rsa.pub or whatever the path to your key is.

  2. Select the key from the output in PuTTY by highlighting it with your mouse; this automatically loads it into your clipboard.

  3. Log in to Github and then paste in the key through their website.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.