Linux – How to copy public private key to linux

linux

I mostly work on windows. I have a public\private key which I use with git source control(github n other repos). Now, I want to use same keys from a linux machine. I have setup a virtual machine on windows with ubuntu. Can I use the same keys? How do I copy them to the linux instance?

Best Answer

You do not want to share the same key with another machine. No, you don't, really.

Each private key should be restricted to one user on one machine only. Do not copy private keys around, since by doing this you are exposing your key to an increased risk of it being stolen or inadvertently copied via untrusted channels, or left on untrusted storage devices.

What you should do is generate a new key pair on the new machine, then transmit your second public key to github. Any decent SSH-based service that allows the use of PKI also allows you to store multiple public keys, github is no exception. Give suggestive names to each key (for SSH keys, they are in the form of "username@hostname") so that you know the device associated to each public key.

This has the benefits of keeping your private keys safe, and you can revoke keys individually when only one of them is compromised.