gitlab-rake gitlab:import:repos creates empty repositories
Summary
gitlab-rake gitlab:import:repos doesn't work at all in the official docker container gitlab/gitlab-ce
Steps to reproduce
# create a test repo with 1 commit
mkdir test && cd test && git init && echo test > test.txt && git add . && git commit -m "test" && cd ..
# make it bare
git clone --bare test
# launch the latest 10.2.2-ce gitlab container
docker run -Pd -v "$(pwd)":/data --name gitlab gitlab/gitlab-ce:10.2.2-ce.0
# wait for it to start, open it in browser and set password for root user, log in
# ssh in and follow instructions from https://docs.gitlab.com/ce/raketasks/import.html
docker exec -ti gitlab bash
mkdir /var/opt/gitlab/git-data/repository-import-2017-12-01
mkdir /var/opt/gitlab/git-data/repository-import-2017-12-01/new_group
cp -R /data/test.git /var/opt/gitlab/git-data/repository-import-2017-12-01/new_group
chown -R git:git /var/opt/gitlab/git-data/repository-import-2017-12-01
gitlab-rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-2017-12-01']
# output:
# Processing /var/opt/gitlab/git-data/repository-import-2017-12-01/new_group/test.git
# * Using namespace: new_group
# * Created test (new_group/test)
Checks
- go to
/new_group/test
in browser and observe repo - run
cd /var/opt/gitlab/git-data/repositories/new_group/test.git && git log
to see repo commits
Expected result:
- See test repo with test.txt and 1 commit
-
git log
shows 1 commit
Actual result:
- See empty repo
-
git log
showsfatal: your current branch 'master' does not have any commits yet
Additional notes
With larger repos it looks like GitLab copies actual data but deletes all references, because repo size after import is the same as before
Edited by Roman Semenov