8

Summary

After backup and migrate, some repositories return "No Repository" error in the web console, and cannot be cloned. The repository is verified to exist as specified in the git_data_dirs folder.

As a test I can clone the "No repository" project from the repositories/ folder directly, so there seems to be nothing wrong with the repo itself.

Steps to reproduce

Not sure how it can be reproduced, but here are the steps i've gone through:

  • backup project on primary server
  • restore tarball on new server
  • go to project path in the new server's web dashboard, and get "No Repository".

The steps I've taken to diagnose the problem. Say the project is called myapp/myapp.foo.git:

  • Go to http://newgitserver.local/myapp/myapp.foo.git
  • Get "No Repository"
  • Look at git_data_dirs in /etc/gitlab/gitlab.rb:

    git_data_dirs({ "default": { "path": "/var/opt/gitlab/git-data"}, "silo": {"path": "/mnt/reposbackup/git-data"} })

  • Note that my project is available in both the folders: /var/opt/gitlab/git-data/repositories/myapp/myapp.foo.git AND /mnt/reposbackup/git-data/repositories/myapp/myapp.foo.git

  • Try restarting the server - same result
  • Try sudo gitlab-ctl reconfigure - same result
  • Try restarting the runsv services: sudo systemctl restart gitlab-runsvdir - same result

I've also looked at the database and the 'projects.repository_storage' value seems correct. Even changing it to 'default' vs 'silo' (which is my alternate dir) does not seem to work.

I'm trying to understand how gitlab makes a determination of where the repository is, since the check for repo-path seems to be what's failing.

SOLUTION

Run sudo gitlab-rake cache:clear once the migration is completed.

cybertoast
  • 1,343
  • 13
  • 19
  • 2
    Hate to answer my own question, but I just found this post after trying everything: https://gitlab.com/gitlab-org/gitlab-ce/issues/31941. It seems the fix is to run ```sudo gitlab-rake cache:clear```. This should probably be documented somewhere! – cybertoast Jul 04 '18 at 19:44
  • thx man, saved me. – gzerone Feb 18 '19 at 06:48
  • unfortunately that does not work for me for some reason – nikoss Mar 19 '19 at 08:48

3 Answers3

2

You likely need to clear the Redis cache. Try running the following command:

sudo gitlab-rake cache:clear

Rake is a general maintenance command that not a lot of users know about, as you'd never need it if you are using the pure cloud offering. It really only applies to on-premise offerings.

Sometimes the issue is purely a network connectivity issue. You can also use rake to check that as well:

sudo gitlab-rake gitlab:tcp_check[ibm.com,80]
Callie Jones
  • 217
  • 1
  • 5
  • 15
  • 1
    please, What represents "ibm.com" in your anwser ? – soung Sep 02 '20 at 10:59
  • 4
    In this case I am just doing a ping, and I need a reliable IP address to hit. I always ping ibm.com because I know they'll likely be up and running. You can use any site you know will reliably respond to a ping. – Callie Jones Sep 02 '20 at 11:39
2

Make sure that the repos are owned by git and then clear the cache.

chown -R git /var/opt/gitlab/git-data/repositories
gitlab-rake cache:clear
Kurt
  • 2,339
  • 2
  • 30
  • 31
0

If you are using docker-compose or docker run, check if the gitlab repository directory has right permissions.

In my case, inside the container /var/opt/gitlab/git-data/repositories/user/my_repos hasn't the right permission(for some reason i ignore). To solve the issu i had to change the ownership of the repos directory.

Even if you are not using docker, permission issues on the repository directory could explain the "No repository" error.

Hope this could help

soung
  • 1,411
  • 16
  • 33