Connecting self-hosted GitLab and other Git Repositories via SSH

To connect to a self-hosted GitLab or any other self-hosted Git repository, choose the tab Others. Enter the URL of your repository. In case of a SSH-based authentication it looks like git@... or ssh://.... If you're not sure about the correct URL, contact your Git hosting/service provider or the administrator of the self-hosted repository.

Activate the SSH key checkbox (default) and click on Download key. You should have a new public key in your Downloads folder; it is named after your DeployBot account's name, followed by a dash and DeployBot.pub (for example agencyX-DeployBot.pub if your company is called agencyX).

If you look at the SSH public key file in a text editor, you should see the structure <algorithm> (RSA), <key> (Base64-encoded), and <comment>, for example:

ssh-rsa AAAAB3NzaC1yc2EAA[...]R/SPdvP agencyX-deployments@DeployBot

Correct Location for the public SSH Key

Next, you need to copy the public key to the correct location, which is dependent on your server setup. Normally, the key is added to the file authorized_keys in the directory ~/.ssh, where ~ is an abbreviation for your home directory. Please make sure you choose the correct home, i.e. for git or any other account you're using to access the repository.

The easiest way to add the public key to the authorized_keys file is to concatenate it onto the file manually by using the cat command:

~$ cat agencyX-DeployBot.pub >> ~/.ssh/authorized_keys

Note: Make sure to use the >> operator to append the key to the file; a single > will overwrite it instead!

Check the permissions of the directory ~/.ssh and of the file authorized_keys. The directory should be readable (r), writable (w) and executable (x) for the owner, the file authorized_keys should be readable (r) and writable (w) for the owner. To make sure the permissions are correct, you can run the following commands:

~$ chmod 700 ~/.ssh

~$ chmod 600 ~/.ssh/authorized_keys

~$ ls -ld ~/.ssh
drwx------+ 42 huhn  staff  1344 19 Jun 10:58 /home/git/.ssh/

~$ ls -l ~/.ssh/authorized_keys
-rw-------+ 1 huhn  staff  1946 17 Mär 12:31 /home/git/.ssh/authorized_keys

Please note that this command needs to be run under the git account or any other account you're using to access the repository.

If you're having issues connecting to a repository on your server, please don't hesitate to contact our support team; we are always glad to help!

Still need help? Contact Us Contact Us