how to fix gitlab ce migration empty repository error

Recently I needed to migrate the gitlab from one server to another one,  followed the step to install gitlab community edition on my new server. I used Omnibus, it is much easier to maintain on the centos.

curl | sudo bash

after installed and reconfigured the gitlab, I tried to restore the back file and configuration folder.

Then I use git pull to test the repository, everything seems good

However after I restarted the gitlab again, suddenly the repository is gone

on my terminal is showing this error

“GitLab: A repository for this project does not exist yet. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.”

on the browser it is showing this

I googled for a while and found no clue, most of the threads are talking about missing repository, but not self installed.

Finally I found one thread mentioning about default git_data_dirs , then I checked the /etc/gitlab/gitlab.rb, and found that the it is pointing to a different folder

#git_data_dirs({ “default” => { “path” => “/var/opt/gitlab/git-data” } })

git_data_dirs({ “default” => { “path” => “/data/gitroot” } })

Not sure when it got changed,  the /data/gitroot folder does exist even though I didn’t manually created them and found some of the repositories there, but not all the repositories.

The  /var/opt/gitlab/git-data has all my repositories, so I just changed back the default git_data_dirs.

Everything works like charm now.