githubsshssh-keysusb-drivenixos

GitHub SSH key on a USB drive


I'm curious if I can put a GitHub SSH key on a USB flash drive as a singular key and remove the other SSH keys from my GitHub. I've found one source, but it doesn't necessarily specify that it's for GH, here.

Any help is appreciated, thanks!

I have yet to experiment, just reading articles/watching YouTube videos to try and get a grasp on it.


Solution

  • As long as you are using a ~/.ssh/config file which points where your SSH key is, you can put said key pair wherever you want.

    Host gh
      Hostname github.com
      User git
      IdentityFile /mnt/usb-device/myKey
    

    In your case, a nix copy --to file:///mnt/usb-device /path/to/key would be needed first.
    However, the tutorial you are referring to is more about copying the key on an encrypted USB stick. Which might be a bit redundant, considering NixOS can be installed with Full Disk Encryption already.