Search code examples
gitlabgit-shell

Gitlab 7.8.4 unable to push with SSH or HTTPS


Our setup: Gitlab CE Gitlab 7.8.4 Git-shell: 2.5.4 Gitlab API: v3 Ruby: 2.1.5p273 Rails: 4.1.1

This is test is on a private repository owned by the same user that is trying to push to it (user is admin). Environment check is clean with no errors. Same error whether we try HTTPS or SSH. SSH worked before the upgrade.

Error:

git push -u origin master
/usr/local/lib/ruby/2.1.0/json/common.rb:155:in `parse': 757: unexpected token at 'false' (JSON::ParserError)
    from /usr/local/lib/ruby/2.1.0/json/common.rb:155:in `parse'
    from /home/git/gitlab-shell/lib/gitlab_access_status.rb:13:in     `create_from_json'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:34:in `check_access'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:25:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>'
fatal: Could not read from remote repository.

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

Similar issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/838

It would appear that we have proper access via HTTPS and SSH, but something on the server, perhaps with git-shell is not right.

What we've done so far:

sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production

Made sure 'AllowUsers git' was in sshd_config

ssh-keygen -A
ssh-keygen: generating new host keys: ED25519

Tried different version of git-shell back to 2.2.0.

# ssh [email protected]
PTY allocation request failed on channel 0
Welcome to GitLab, Anonymous!
Connection to gitlab.domain.com closed.

Solution

  • As Geoff pointed out, my issue was a badly configured gitlab-shell/config.yml. Once the type for gitlab_url was corrected, we were able to push and pull without any issues with HTTPS and SSH.