GitLab: Could not read from remote repository

When you try to push to GitLab you may end up with following error message:

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
 and the repository exists.

It’s not very clear what’s real cause. You may check the permission, but it might not solve the problem.

One quick solution could be just restart of GitLab service. It still might not help.

Let’s learn some mechanics of GitLab.

You send data via ssh to GitLab server. When authentication by key is succesfull then server will invoke gitlab-shell. This will shell send request to web interface of GitLab. Yes, web interface. Then it will allow you to access git repository.

Schema:

git -> ssh -> sshd -> gitlab-shell -> gitlab web

The problem described in the beginning of this article is between gitlab-shell and gitlab-web. Most likely shell is not able to access gitlab web. URL is broken or host configuration is incorrect or port is not reachable.

Just go to gitlab-shell project and open file config.yml. You’ll see something like this:

gitlab_url: "http://localhost:80/"

Test this URL directly on server e.g. by links:

links http://localhost:80/

You may need to change hostname or port or add base directory to URL. Fix the URL so the gitlab-shell is able to access web interface. Restart gitlab service and try to push again.

Further discussion about this and similar problems is available at github.

5 Replies to “GitLab: Could not read from remote repository

Comments are closed.