Problem connecting to a repository by SSH


Since a couple of days ago, I'm configuring GIT on a Linux server using GitLab (which was already pre-installed).

I have created a new project, and if I connect via HTTP I do not have any problems. I do it to the following address: link

However, when I try to connect via SSH to the following address: ssh: //[email protected]: 10022 / git / Probando.git jumps an error message that goes like this:


Incorrect credentials for repository at   ssh: // 10022 / git / Probando.git

I think the problem is with the SSH Keys. I have created a key and I have inserted it, but it seems that it does not work. I describe how I created and inserted it:

  • Initialize the repository:

    git init
  • I access the following route

    cd ~/.ssh
  • I generate the new password using the email [email protected]

    ssh-keygen -t rsa -C '[email protected]'

    When he tells me to enter the name of a file, I type git_rsa

    When he says Enter passphrase I leave it blank (pulse enter)

    [~/.ssh] # ssh-keygen -t rsa -C '[email protected]'
    Generating public/private rsa key pair.
    Enter file in which to save the key (/share/homes/admin/.ssh/id_rsa): git_rsa
    git_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in git_rsa.
    Your public key has been saved in
    The key fingerprint is:
    SHA256:uiwCccsRLRC7IrTmRufRKi4O0LGsx7L8lcBqt1bOaX4 [email protected]
    The key's randomart image is:
    +---[RSA 2048]----+
    |oo .             |
    | .o .            |
    |...o             |
    |o+=o.            |
    |=B+B .  S        |
    |Oo* +...         |
    |+Bo++oo          |
    |B++.+* E         |
    |++o+oo+          |
  • Now I print the generated key and copy it:


    It's something like that (I delete a piece for security):

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC12zoBWILH38qY+hSLgPUwEChh2BdH9C/ydHP/EBBzm5nAJGRB.....................6IlE2RI4c/4iF1995oONG85yzy6sVEKe/qgRM0CGwrRNT00/491JjmdjZwvzVlii+5wdd4BUvHbn/N5Somt1XBVFtsPzhIetHgXKB [email protected]
  • I go to GitLab and open the SSH Keys tab

    • Pulse in ADD SSH KEY
    • I paste the copied key
    • I keep the changes
    • It is assumed that the key is already inserted ....
  • But when I go in, I enter the SSH address, username and password (the same credentials that the HTTP connection works correctly for) and it tells me that the credentials are incorrect.

  • Any ideas of what may be happening?

    asked by Pedro 04.04.2016 в 00:48

    2 answers


    The problem is that git can not find your password, since you are giving it a name that ssh is not looking for. When you connect to a server using ssh, your pc sends you the public keys you have available (which searches in the directory ~/.ssh with the usual names ( , , etc), can not know which other files They are public keys.

    To find these types of errors well, what is better is to try an ssh connection with the verbose level high (to see what is failing)

    ssh -vvv

    Git lab will not give you accesso shell, anyway, but if you have an authentication error you will be able to see the detail (as in this case, for example, public keys are presenting).

    To solve the problem, what you have to do is let ssh find your key either by using a common name for that (and the correct directory) or by copying your private key in ~/.ssh/id_rsa and public in ~/.ssh/ or adding the key that to the ssh agent ( ssh-agent ) with the command: ssh-add git_rsa .


    Apparently, you can also indicate additional file names that ssh will search by adding in the ~/.ssh/config file (which can be created for that purpose):

    Host *
      IdentityFile ~/.ssh/git_rsa

    In this way, it is not necessary to use the ssh-agent (and therefore%% of% is not used)

    answered by 04.04.2016 в 15:46

    It seems that everything is correct following the documentation of GitLab link , so I would recommend that you verify the that has the following permissions in the following routes:

    • 0711 in / home / $ YOUR_USER
    • 0700 in /home/$TU_USUARIO/.ssh
    • 0600 at /home/$TU_USUARIO/.ssh/authorized_keys

    Also, verify that in the ssh configuration file located in ~ / .ssh / config look for the public keys in the path where you have added them.

    answered by 04.04.2016 в 15:55