Skip to content

SSH key for git user on gitlab server

According to https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/ssh/README.md#ssh-on-the-gitlab-server it is strongly discouraged to create SSH key for the user git on the gitlab server. But the ebuild does so in the pkg_postinst function and then the check

$ gitlab-rake gitlab:check
# ...
Git user has default SSH configuration? ... no
  Try fixing it:
  mkdir ~/gitlab-check-backup-1504540051
  sudo mv /var/lib/git/.ssh/id_rsa ~/gitlab-check-backup-1504540051
  sudo mv /var/lib/git/.ssh/id_rsa.pub ~/gitlab-check-backup-1504540051
  For more information see:
  doc/ssh/README.md in section "SSH on the GitLab server"
  Please fix the error above and rerun the checks.

always critizes this and tells me to remove the id_rsa files again.

So I think the lines

        if [ ! -e "${GIT_HOME}/.ssh/id_rsa" ]; then
                einfo "Generating SSH key for git user"
                su -l ${GIT_USER} -s /bin/sh -c "
                        ssh-keygen -q -N '' -t rsa -f ${GIT_HOME}/.ssh/id_rsa" \
                        || die "failed to generate SSH key"
        fi

at the start of pkg_postinst() should be removed.