0

I am trying to configure git with ssh access so on my ubuntu virtual machine I generated a key pair. as per instructions here https://linuxtechlab.com/how-to-install-github-on-ubuntu-step-by-step/

$ ssh-keygen -t rsa -C “your_email@youremail.com” the key I have generated is following user_rsa

-----BEGIN OPENSSH PRIVATE KEY-----
nY6auyJS1pmqLyAl6tRu4EstZHxqQwAAAAMBAAEAAAGAfINVuhW9Rp5JAwzppNZ8FfmvM4
K8UTqx91auY6tg0EwlcufCJUhhRGF7qzkk/lzEVrwHRhZhAEEQZ8jH1sjq0ra+D+TLdFfZ
mtr3Qy5I6QPvByqa70Ui93/X/EKHPfH9o4itL+iQheg/H8aZxZw2dP4nePJgjAaCwGZNqn
+PlIAvvDAt71t9K2fyDObX4TXikhezAAAAwQDBsrclMLbe6cwSpDWEOIaTNLiuVtbdXMm9
-----END OPENSSH PRIVATE KEY-----

and another key is user_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC6DjhVkM23obhvltLHujI8JFXtClAjaeXMXmR/AbOR6jUA8Xpuc8+9o8PJjgmDcxr7wzyH9SpgdkQUmXhHv48uQVF9PjSw9esgQPsRT/aNurLa6xeCyR1t8fGRAd4BkyLxvhODGimBIO2km65bjXz+DB3M0IaWtTnxik9tWy2pSQTiXqNi0Cwi/C5MA0Ey6ElhyQdoH4IZUlnDtAbzlqFB1Qr8gADqg6uI0CQjVp0KW+zlC4gEP0ycoDjT1VjCFvwAtNRKrM6rtSdH44UvEyhXEWYjNg5d6Vqxzy/lYUhzLejwm4enypCRNFv/Bfx8tbDjRhBXAkYa3ZTXYaAYfz4heOFoksreYakVI2oT2qI0apFGwbI1DMz9jr13Jn32lC/80WMk21SAKihXtSS0b0YMVqRi+EYjat5gF+gmZleW5ehAmxHhY0B7i8e9Gi14LkgavqTJDXV8t6kJjVrvqvcGDdjeGPWb4nqH3p2OmrsiUtaZqi8gJerUbuBLLWR8akM= username@gmail.com

I try to add both keys the private key is added

debian@osboxes:~/git_keys$ ssh-add ./user_rsa

for public key I get error debian@osboxes:~/git_keys$ ssh-add ./user_rsa.pub Error loading key "./user_rsa.pub": invalid format

what should I do now to configure ssh access. Is adding public key required or not?

debian@osboxes:~/git_keys$ ssh-add user_rsa.pub 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for 'user_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

I had changed the permissions also for user_rsa.pub to 600 but I still get the error

debian@osboxes:~/git_keys$ ssh-add ./user_rsa.pub 
Error loading key "./user_rsa.pub": invalid format

I am not able to understand what to do now from here?

phd
  • 82,685
  • 13
  • 120
  • 165
koeradoera
  • 507
  • 1
  • 4
  • 9

1 Answers1

0

You don't need to load the public key into ssh-add; it does that automatically when you add the corresponding private key.

legoscia
  • 39,593
  • 22
  • 116
  • 167