Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab import: Could not locate Gemfile

Tags:

gitlab

I have a test VM with Debian Wheezy and no ruby installed. Gitlab 6.9.2 has been installed using the provided installer which brings an embedded ruby. Now, I want to import some old repos into Gitlab, but I cannot find the correct procedure. I think it should be this way:

su - git
export PATH=$PATH:/opt/gitlab/embedded/bin
cd ~
bundle exec rake gitlab:import:repos RAILS_ENV=production

Though, I only get the error "Could not locate Gemfile". I have tried several other ways, also installing Debians ruby, searched multiple Google and StackOverflow results, but I couldn´t get it to work.

like image 518
Larsen Avatar asked Oct 01 '22 13:10

Larsen


2 Answers

You should first place the bare repos in the repo dir. The default path for omnibus is /var/opt/gitlab/git-data/repositories/<namespace>. Then you just run the rake task:

sudo -u git -H cp -r my-project/.git /var/opt/gitlab/git-data/repositories/<namespace>/my-project.git
sudo gitlab-rake gitlab:import:repos

See invoking rake tasks and the import mechanism.

Edit: Sent an MR upstream to include this info in the readme.

like image 66
axil Avatar answered Oct 03 '22 02:10

axil


I have run into same issue with "Could not locate Gemfile". So I searched for Gemfile and tried several folders. Until it worked.

The solution is related to Gitlab from source (or in my case it run inside offical docker container).

Place your .git bare repository (or several of them) in "/var/opt/gitlab/git-data/repositories//my-project.git"

switch to user "git".

su git

Try if you have correct PATH by just "rake". If not available, extend your PATH:

export PATH=$PATH:/opt/gitlab/embedded/bin

after that switch to the shell were the rake command to import your bare projects will work and do the import.

cd /opt/gitlab/embedded/service/gitlab-rails/
bundle exec rake gitlab:import:repos RAILS_ENV=production

Output will be similar to this:

Processing raspberry/apollo-web.git
 * Created apollo-web (raspberry/apollo-web.git)
Processing raspberry/apollo-web.wiki.git
 * Skipping wiki repo
Processing dhbw/dhbw-prototyping-node-rest-course.git
...

EDIT: Ok I was happy a bit too early. Although the ouput says it was imported. On the Web GUI no new projects.

I will investiage further...

like image 33
sbejga Avatar answered Oct 03 '22 04:10

sbejga