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.
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:
Test this URL directly on server e.g. by links:
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.
I’m glad that I had opportunity to join Startup Camp in Trhový Štěpánov as mentor. Together with startup teams we were discussing and preparing new sites for their products. People were learning how to use Git, how to program in Python and how to create sites in Django. At the end of the day they were able to create prototype or deploy it to Heroku cloud.