Forrest logo
back to the gh tool

gh-ssh-key:tldr:f2b84

gh-ssh-key: Add an SSH key to the currently authenticated user's account.
$ gh ssh-key add ${path-to-key-pub}
try on your machine

The command "gh ssh-key add ${path-to-key-pub}" is used to add an SSH key to your GitHub account using the GitHub CLI (Command-line Interface).

Here's a breakdown of the command:

  • "gh": It is the command used to interact with GitHub using the GitHub CLI.
  • "ssh-key": It is a sub-command of "gh" used for managing SSH keys.
  • "add": It is an option within the "ssh-key" sub-command to add a new SSH key.
  • "${path-to-key-pub}": It is a placeholder for the path to the public SSH key file you want to add. You need to replace "${path-to-key-pub}" with the actual file path of your SSH public key.

In order to use this command, you need to have the GitHub CLI (gh) installed and authenticated with your GitHub account. Once executed, it will add the SSH key file specified by the path to your GitHub account, allowing you to use SSH to authenticate and interact with your GitHub repositories.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gh tool