Repo gets lost when moving a project with the same name into another group with an identically named project.
Summary
In part of a cleanup, I encountered a bug in which I lost a repository to a probably unrecoverable state.
I had the following setup
(Group) maintained - (Subgroup) NPM Projects - (Project) npm-xyz-xyz - (Project) npm-abc-abc
I then gave the Custom Name "Example" to "npm-xyz-xyz" which worked fine. Not thinking a lot, I then later renamed "npm-abc-abc" to "Example" as well (To be noted, those are just custom names, doesnt change the repository path)
Still everything was fine so far.
Then, hit me, I moved "npm-abc-abc" to "NPM Projects". Which failed in half of the task, although it told me that it was successful. Now I cant access the "npm-abc-abc" repo in any way.
Steps to reproduce
I described my steps above
Example Project
I cannot create an example here, as it would be broken already.
What is the current bug behavior?
Repository is being moved half-way, then breaks unrecoverable through GUI.
What is the expected correct behavior?
An information that the custom name is duplicate. Or a rename to "Custom Name (2)". Everything but a dead repo.
Relevant logs and/or screenshots
When I try to access the old URL of the broken repo: ERR_TOO_MANY_REDIRECTS
When I try to access the new URL:
Results of GitLab environment info
Expand for output related to GitLab environment info
root@git:~# sudo gitlab-rake gitlab:env:infoSystem information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.17.1 Sidekiq Version:5.1.3 Go Version: unknown
GitLab information Version: 11.0.4 Revision: edb037c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://redacted HTTP Clone URL: https://redacted/some-group/some-project.git SSH Clone URL: git@redacted:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 7.1.4 Repository storage paths:
- default: /opt/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
root@git:~# sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab Shell ...
GitLab Shell version >= 7.1.4 ? ... OK (7.1.4) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 37/2 ... ok 37/3 ... ok 37/4 ... ok 37/5 ... ok 46/6 ... ok 43/8 ... ok 43/9 ... ok 35/10 ... ok 45/11 ... ok 37/12 ... ok 5/13 ... ok 35/14 ... ok 43/15 ... ok 37/17 ... ok 35/18 ... ok 37/19 ... ok 10/20 ... ok 43/24 ... ok 35/25 ... ok 45/26 ... ok 40/27 ... ok 40/29 ... ok 35/30 ... ok 10/31 ... ok 45/32 ... ok 35/33 ... ok 45/35 ... ok 34/36 ... ok 10/37 ... ok 24/38 ... repository is empty 35/41 ... ok 40/42 ... ok 46/43 ... ok 35/44 ... ok 10/46 ... ok 17/47 ... ok 38/48 ... ok 38/49 ... ok 47/50 ... ok 43/51 ... ok 45/52 ... ok 5/53 ... ok 10/54 ... ok 10/56 ... ok 38/57 ... ok 10/59 ... ok 10/60 ... ok 10/61 ... ok 43/62 ... ok 40/63 ... ok 37/64 ... ok 38/65 ... ok 38/66 ... ok 18/67 ... ok 10/68 ... ok 5/69 ... ok 10/70 ... ok 10/71 ... ok 40/72 ... ok 10/73 ... ok 37/74 ... ok 37/106 ... ok 44/108 ... ok 44/110 ... ok 37/111 ... ok 37/112 ... ok 44/113 ... ok 45/114 ... ok 37/115 ... repository is empty 44/116 ... ok 37/117 ... ok 24/118 ... ok 24/119 ... repository is empty 37/120 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) // Hidden
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... no Try fixing it: sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} ; sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} ; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 37/2 ... yes 37/3 ... yes 37/4 ... yes 37/5 ... yes 46/6 ... yes 43/8 ... yes 43/9 ... yes 35/10 ... yes 45/11 ... yes 37/12 ... yes 5/13 ... yes 35/14 ... yes 43/15 ... yes 37/17 ... yes 35/18 ... yes 37/19 ... yes 10/20 ... yes 43/24 ... yes 35/25 ... yes 45/26 ... yes 40/27 ... yes 40/29 ... yes 35/30 ... yes 10/31 ... yes 45/32 ... yes 35/33 ... yes 45/35 ... yes 34/36 ... yes 10/37 ... yes 24/38 ... yes 35/41 ... yes 40/42 ... yes 46/43 ... yes 35/44 ... yes 10/46 ... yes 17/47 ... yes 38/48 ... yes 38/49 ... yes 47/50 ... yes 43/51 ... yes 45/52 ... yes 5/53 ... yes 10/54 ... yes 10/56 ... yes 38/57 ... yes 10/59 ... yes 10/60 ... yes 10/61 ... yes 43/62 ... yes 40/63 ... yes 37/64 ... yes 38/65 ... yes 38/66 ... yes 18/67 ... yes 10/68 ... yes 5/69 ... yes 10/70 ... yes 10/71 ... yes 40/72 ... yes 10/73 ... yes 37/74 ... yes 37/106 ... yes 44/108 ... yes 44/110 ... yes 37/111 ... yes 37/112 ... yes 44/113 ... yes 45/114 ... yes 37/115 ... yes 44/116 ... yes 37/117 ... yes 24/118 ... yes 24/119 ... yes 37/120 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.17.1) Git user has default SSH configuration? ... yes Active users: ... 22
Checking GitLab ... Finished
Possible fixes
// Edit (With very hacky workaround)
I was able to recover the lost repository by doing some frontend changes in my browser.
- Go to the new URL and enter the general settings
- Enter any name that isn't taken.
- Edit the post URL in the form tag with Developer tools to match the new URL instead of the old one. (Yes it uses the OLD URL everywhere instead of the new one)
- Click rename.
I found that the files on the filesystem are not touched. Just a mess in the database which leads to redirects and thus no access to your files without a bit of hacking.