About addition of SSH keys to your account
Puedes acceder a datos y escribirlos en repositorios en your GitHub Enterprise Server instance mediante SSH (Protocolo Secure Shell). Al conectarse a través de SSH, se realiza la autenticación mediante un archivo de clave privada en el equipo local. For more information, see "About SSH."
After you generate an SSH key pair, you must add the public key to your GitHub Enterprise Server instance to enable SSH access for your account.
Prerequisites
Before adding a new SSH key to your account on your GitHub Enterprise Server instance, complete the following steps.
- Check for existing SSH keys. For more information, see "Checking for existing SSH keys."
- Generate a new SSH key and add it to your machine's SSH agent. For more information, see "Generating a new SSH key and adding it to the ssh-agent."
Adding a new SSH key to your account
After adding a new SSH authentication key to your account on your GitHub Enterprise Server instance, you can reconfigure any local repositories to use SSH. For more information, see "Switching remote URLs from HTTPS to SSH."
-
Copy the SSH public key to your clipboard.
If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
$ pbcopy < ~/.ssh/id_ed25519.pub # Copies the contents of the id_ed25519.pub file to your clipboard
Tip: If
pbcopy
isn't working, you can locate the hidden.ssh
folder, open the file in your favorite text editor, and copy it to your clipboard.$ clip < ~/.ssh/id_ed25519.pub # Copies the contents of the id_ed25519.pub file to your clipboard
Tip: If
clip
isn't working, you can locate the hidden.ssh
folder, open the file in your favorite text editor, and copy it to your clipboard.$ cat ~/.ssh/id_ed25519.pub # Then select and copy the contents of the id_ed25519.pub file # displayed in the terminal to your clipboard
Tip: Alternatively, you can locate the hidden
.ssh
folder, open the file in your favorite text editor, and copy it to your clipboard. -
En la esquina superior derecha de cualquier página, haga clic en la foto del perfil y, luego, en Settings (Configuración).
-
In the user settings sidebar, click SSH and GPG keys.
-
Click New SSH key or Add SSH key.
-
In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal laptop, you might call this key "Personal laptop".
-
Paste your key into the "Key" field.
-
Click Add SSH key.
-
Si se te solicita, confirma tu contraseña en GitHub Enterprise Server. Para obtener más información, consulta «modo sudo».
Para obtener más información sobre GitHub CLI, vea "Acerca de GitHub CLI".
Before you can use the GitHub CLI to add an SSH key to your account, you must authenticate to the GitHub CLI. For more information, see gh auth login
in the GitHub CLI documentation.
To add an SSH authentication key to your GitHub account, use the ssh-key add
subcommand, specifying your public key.
gh ssh-key add KEY-FILE
To include a title for the new key, use the -t
or --title
flag.
gh ssh-key add KEY-FILE --title "personal laptop"
If you generated your SSH key by following the instructions in "Generating a new SSH key", you can add the key to your account with this command.
gh ssh-key add ~/.ssh/id_ed25519.pub