Bitbucket & GitHub import fails when importing a public repository into a private group

Summary

If a Bitbucket or GitHub repository has "This is a private repository" unchecked in its settings, when imported into a private group, the job creation will fail, with "Unable to save project. Error: Visibility level public is not allowed in a private group." appearing in the logs.

Steps to reproduce

  1. Have a public Bitbucket or GitHub repository to import (uncheck "This is a private repository")
  2. Create a private group on GitLab
  3. Attempt to import the repository

What is the current bug behavior?

When "Import" is clicked, the job creation will fail with HTTP error "422 Unprocessable Entity", and the message will be displayed in the logs: "Unable to save project. Error: Visibility level public is not allowed in a private group."

What is the expected correct behavior?

Project is imported.

Relevant logs and/or screenshots

Unable to save project. Error: Visibility level public is not allowed in a private group.
Completed 422 Unprocessable Entity in 1077ms (Views: 0.2ms | ActiveRecord: 10.2ms)

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.3.7p456
Gem Version:    2.6.14
Bundler Version:1.13.7
Rake Version:   12.3.1
Redis Version:  3.2.11
Git Version:    2.16.4
Sidekiq Version:5.0.5
Go Version:     unknown

GitLab information Version: 10.8.3 Revision: 564c342 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://xxx HTTP Clone URL: https://xxx/some-group/some-project.git SSH Clone URL: ssh://git@xxx:2222/some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 7.1.2 Repository storage paths:

  • default: /var/opt/gitlab/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
Checking GitLab Shell ...

GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) 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: ... 1/1 ... ok 1/2 ... ok 1/3 ... ok 1/4 ... ok 1/5 ... ok 2/6 ... repository is empty 1/7 ... ok 1/8 ... ok 1/9 ... ok 3/10 ... ok 3/11 ... ok 4/12 ... ok 4/13 ... ok 2/14 ... repository is empty 1/15 ... ok 5/16 ... ok 5/17 ... ok 1/18 ... ok 1/19 ... ok 1/20 ... ok 1/21 ... ok 1/22 ... ok 1/23 ... ok 1/24 ... ok 1/25 ... ok 1/26 ... ok 1/27 ... ok 6/28 ... ok 6/29 ... ok 6/30 ... ok 6/31 ... ok 6/32 ... 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 ...

LDAP is disabled in config/gitlab.yml

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? ... skipped (no tmp uploads folder yet) 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: ... 1/1 ... yes 1/2 ... yes 1/3 ... yes 1/4 ... yes 1/5 ... yes 2/6 ... yes 1/7 ... yes 1/8 ... yes 1/9 ... yes 3/10 ... yes 3/11 ... yes 4/12 ... yes 4/13 ... yes 2/14 ... yes 1/15 ... yes 5/16 ... yes 5/17 ... yes 1/18 ... yes 1/19 ... yes 1/20 ... yes 1/21 ... yes 1/22 ... yes 1/23 ... yes 1/24 ... yes 1/25 ... yes 1/26 ... yes 1/27 ... yes 6/28 ... yes 6/29 ... yes 6/30 ... yes 6/31 ... yes 6/32 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.7) Git version >= 2.9.5 ? ... yes (2.16.4) Git user has default SSH configuration? ... yes Active users: ... 1

Checking GitLab ... Finished

Edited by Adam Mulvany