Fixing gitlab errors with git operations

Recenlty, I was able to install the 5.2 branch of gitlab for work.

I ran into the following error when cloning a repo:

git pull
fatal: Could not read from remote repository.

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

yet, ssh and ssh keys were working:

ssh -T git@gitlab.lib.unc.edu
Welcome to GitLab, Anonymous!

It took a while, but I found a way to check what gitlab-shell is doing:

gitlab-shell/bin/check

Check GitLab API access: FAILED. code: 302

Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK

This does make sense because it set up SSL in the apache conf for gitlab using the example conf file. It seems that gitlab-shell isn’t smart enough to handle a redirect to the https side. So in the gitlab-shell/config.yml make sure the gitlab_url setting has https set. Also, you may need to make sure your /etc/hosts has the name of the virtual host (if you are running it that way) pointing to the right interface.

Keep in mind, gitlab-shell doesn’t play nice with self-signed certs. I had to revert some things on another gitlab install.

After fixing this, ssh-ing into the server worked right:

ssh -T git@gitlab.lib.unc.edu
Welcome to GitLab, <user>!

Leave a Reply