Configure SSH Public Key¶
This guide explains how to configure an SSH public key.
Check for an Existing SSH Public Key¶
Before generating a new SSH key, check whether you already have one. SSH key pairs are usually stored in the user's home directory.
On Linux and macOS, use the following commands to check for an existing public key.
On Windows, use these commands in WSL (requires Windows 10 or above) or Git Bash.
-
ED25519 algorithm:
-
RSA algorithm:
If a long string beginning with ssh-ed25519
or ssh-rsa
is returned, it means a local public key already exists.
You can skip to Copy SSH Public Key without generating a new one.
Generate a New SSH Public Key¶
If no key was found in Check for an Existing SSH Public Key, follow the steps below to generate a new one:
-
Open a terminal (on Windows, use WSL or Git Bash), and run
ssh-keygen -t
. -
Enter the desired key type and an optional comment.
The comment appears in the.pub
file, and it's common to use an email address.-
To generate a key pair with the
ED25519
algorithm: -
To generate a key pair with the
RSA
algorithm:
-
-
Press Enter to choose the file path where the key will be saved.
For ED25519, the default path looks like this:
Generating public/private ed25519 key pair. Enter file in which to save the key (/home/user/.ssh/id_ed25519):
Default private key path:
/home/user/.ssh/id_ed25519
Corresponding public key:/home/user/.ssh/id_ed25519.pub
-
Set a passphrase:
You can choose to leave it empty.
If you don’t want to be prompted for a passphrase each time you access a repository over SSH, enter nothing and press Enter. -
Press Enter to complete the key pair creation.
Copy Your Public Key¶
In addition to manually copying the public key from the terminal output, you can use the following commands to copy the public key to your clipboard, depending on your operating system:
Add Your Public Key¶
-
Log in to the web UI, then navigate to Personal Center -> SSH Public Key -> Import SSH Public Key
-
Add your generated SSH public key details:
- Name
- SSH Public Key Content
- Validity Period : Permanent or Custom