An SSH key allows establish a secure connection between your computer and GitLab.
Before generating an SSH key, check if your system already have one by running cat ~/.ssh/id_rsa.pub
. If you see a long string starting ssh-rsa
with or ssh-dsa
, you can skip the Ssh-keygen step.
To generate a new SSH key, just open your terminal and use code below. The Ssh-keygen command prompts a location and filename to store the key pair and for a password. When prompted is the location and filename, you can press enter into use the default.
It's a best practice-password for a SSH key, but it's not required and you can skip creating a password by pre Ssing Enter. Note that the password-choose here can ' t be altered or retrieved.
"*********@email.com"
Use the code below to show your public key.
cat ~/.ssh/id_rsa.pub
Copy-paste the key to the ' My ssh Keys ' sections under the ' SSH ' tab in your user profile. Please copy the complete key starting with and ssh-
ending with your username and host.
Use code below to copy your public key to the Clipboard. Depending on your OS "ll need to use a different command:
Windows:
clip < ~/.ssh/id_rsa.pub
Mac:
pbcopy < ~/.ssh/id_rsa.pub
Linux (Requires Xclip):
xclip -sel clip < ~/.ssh/id_rsa.pub
Deploy keys
Deploy keys allow read-only access to multiple projects with a single SSH key.
This is really useful for cloning repositories to your continuous integration (CI) server. By using the Deploy keys, you do not have the to setup a dummy the user account.
If you is a project master or owner, you can add a to deploy key in the project settings under the section ' Deploy Keys '. Press the ' New Deploy Key ' button and upload a public SSH key. After this, the machine is uses the corresponding private key has a read-only access to the project.
You can ' t add the same deploy key twice with the ' New deploy key ' option. If you want to add the same key to another project, please enable it in the list that says ' Deploy keys from projects Avai lable to you '. All the Deploy keys, the projects you, has access to is available. This project access can happen through being a direct member of the PROJECTI, or through a group. See in for more def accessible_deploy_keys
app/models/user.rb
information.
SSH Keys Generate