docs/_includes/content/ssh/ssh-copy-key.md

2.0 KiB

  • Mac
  • Windows
  • Linux

{% capture mac-content-copy %}

Copy the public SSH key to your clipboard.

$ pbcopy < ~/.ssh/id_rsa.pub

If your SSH key file has a different name than the example code, modify the filename to match your current setup.

Tip: If you don't have pbcopy, you navigate to the hidden .ssh folder, open the file in a text editor, and copy it to your clipboard. For example: $ atom ~/.ssh/id_rsa.pub

{% endcapture %} {{ mac-content-copy | markdownify }}



{% capture win-content-copy %}

Copy the public SSH key to your clipboard.

$ clip < ~/.ssh/id_rsa.pub

If your SSH key file has a different name than the example code, modify the filename to match your current setup.

Tip: If clip doesn't work, navigate the hidden .ssh folder, open the file in a text editor, and copy it to your clipboard. For example: $ notepad ~/.ssh/id_rsa.pub

{% endcapture %} {{ win-content-copy | markdownify }}



{% capture linux-content-copy %}

If you don't already have it, install xclip. (The example uses apt-get to install, but you might want to use another package installer like yum.)

$ sudo apt-get install xclip

Copy the SSH key to your clipboard.

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

Tip: If you xclip isn't working, navigate to hidden .ssh folder, open the file in a text editor, and copy it to your clipboard. For example: $ vi ~/.ssh/id_rsa.pub

{% endcapture %} {{ linux-content-copy | markdownify }}