Can't get push to a remote repository feature to work (possible bug?)

Hi, I’m trying to use the “Push to a remote repository” feature located in settings → repository, but have problems configuring it.
I want to use git over ssh with public key auth, but there is no place I can find the public key to use on the other server.

There is the “pull from remote repository” tab that has a configuration dialog that pops out when I type in a ssh:// URI, but noting like this in the push tab.

When I try to connect without a public key, or with the one that was in the pull tab, I always get:

The remote repository failed to update 17 minutes ago.
2:Fetching remote remote_mirror_[snip] failed: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

And in my /var/log/auth.log I get only:

Apr 16 10:20:13 [servername] sshd[6940]: Connection closed by 40.84.46.166 [preauth]

Where 40.84.46.166 seems to be an azure server.

The Git repository URL I’m using is in the form of ssh://gitolite@example.com/repo.git, and I understand that this is the equivalent of gitolite@example.com:repo.git used in a git remote.

Also, in the inspector console, there are two potential issues (project ids, tokens and paths censored):

repository:1 [DOM] Found 2 elements with non-unique id #: (More info: https://goo.gl/9p2vKq) 

<input type=​"search" id class=​"dropdown-input-field" placeholder=​"Search protected branches" autocomplete=​"off">​

<input type=​"search" id class=​"dropdown-input-field" placeholder=​"Search protected tags" autocomplete=​"off">​
repository:1 [DOM] Found 2 elements with non-unique id #0000000: (More info: https://goo.gl/9p2vKq) 

<form class=​"gl-show-field-errors project-mirror-push-form js-project-mirror-push-form" autocomplete=​"false" data-project-mirror-endpoint=​"[snip]/​mirror/​ssh_host_keys.json" 
id=​"0000000" action=​"[snip]/​mirror" accept-charset=​"UTF-8" method=​"post">​…​</form>​<input name=​"utf8" type=​"hidden" value=​"✓">​<input type=​"hidden" name=​"_method" 
value=​"patch">​<input type=​"hidden" name=​"authenticity_token" value=​"[tokentokentoken]">​<div>​
​</div>​<div class=​"form-group">​…​</div>​<div class=​"form-group">​…​</div>​<div class=​"account-well prepend-top-default append-bottom-default">​…​</div>​<div class=​"form-group 
js-ssh-host-keys-section">​…​</div>​<div class=​"form-group">​…​</div>​<div class=​"form-group">​…​</div>​<input type=​"hidden" value=​"111111" name=​"project[import_data_attributes]​[id]​" 
id=​"project_import_data_attributes_id">​<div class=​"form-group">​…​</div>​<div class=​"form-group">​…​</div>​<div class=​"form-group">​…​</div>​<div class=​"form-group">​…​</div>​<input type=​"submit"
 name=​"update_remote_mirror" value=​"Save changes" class=​"btn btn-create">​</form>​ 

<form class=​"edit_project" id=​"0000000" action=​"[snip]/​mirror" accept-charset=​"UTF-8" method=​"post">​…​</form>​

Using the hosted version at gitlab.com.
The other server is using gitolite (so git over ssh with public key auth)

Now I have tried to use the pull on another repository, and nothing happens. Gitlab just didn’t try to connect. Not even a try from 40.84.46.166.

@chanibal - i realize i’m coming i late, but in case you’re still in need, the SSH key is in /var/opt/gitlab/.ssh/.
Also keep in mind that the path of the SSH URL needs to be explicit, meaning that if your repo is in /home/git/repos/ on the remote host, then your ssh URL will be ssh://git@remote.ssh.host/home/git/repos/myrepo.git.

In our organization we are using a similar setup as @chanibal describes:
We migrated from gitolite to Gitlab EE and thought we can use Repository-Mirroring for publishing changes to gitolite because we still need these changes in gitolite for redmine (hard to explain - believe me, there are no alternatives).

Turns out, gitlab is able to pull via ssh and public-key but not able to push. Why?! I do not get this restriction.

Here is the workaround:

We use a docker-runner for processing all project’s jobs. For mirroring i set up a new job:

gitolite_mirror:
  stage: mirror
  image:
    name: alpine/git
    entrypoint: [ "/bin/sh", "-c" ]
  variables:
    GIT_STRATEGY: clone
    GIT_CHECKOUT: "false"
  script: |
    mkdir -p ~/.ssh
    echo "${GITLAB_MIRROR_SERVICE}" > ~/.ssh/id_ecdsa
    echo "${GITOLITE_HOST_KEY}" > ~/.ssh/known_hosts
    chmod go-rw -R ~/.ssh
    cd /tmp
    git clone --mirror ${CI_REPOSITORY_URL} project
    cd project
    git remote add gitolite git@${GITOLITE_HOST}:git-test.git
    git push --mirror gitolite
  tags:
  - docker

This job will be performed in the stage mirror and uses the alpine/git docker-image to mirror-clone and mirror-push the repo to gitolite. You need to provide 3 variables:

  • GITLAB_MIRROR_SERVICE: the private-key for ssh-authentication
  • GITOLITE_SSH_FINGERPRINT: the host-key for the gitolite-server
  • GITOLITE_HOST: the hostname or ip of the gitolite-server