Skip to content

Unable to import project from gitlab.com to gitlab instance (too many redirects)

Summary

I'm trying to import a project from Gitlab.com to our hosted GitLab instance. I was following this instaruction to authorize the application https://docs.gitlab.com/ce/integration/gitlab.html. All was done good. But when I'm trying to import project from GitLab.com I'm getting the error: gitlab.com redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS

I tried to disable https for our gitlab to prevent any internal redirects, but no luck.

Steps to reproduce

Authenticate the GitLab instance with GitLab omniauth Put example configuration into gitlab.rb file: gitlab_rails['omniauth_providers'] = [ {![Capture](/uploads/6d55ffb51d227e71dc077403ced1f69d/Capture.JPG) "name" => "gitlab", "app_id" => "XXX", "app_secret" => "XXX", "args" => { "scope" => "api" } } ] Reconfigure and restart gitlab Try to import project from GitLab.com

Example Project

Here is the public test project to try on https://gitlab.com/elnino-nic/my-import-project.git

What is the current bug behavior?

I'm getting "TOO MANY REDIRECTS ERROR" Please see screenshot attached

What is the expected correct behavior?

Instead I expect to get the list of projects I could import as discribed here https://docs.gitlab.com/ce/integration/gitlab.html

Relevant logs and/or screenshots

gitlab-ctl tail output:

==> /var/log/gitlab/nginx/gitlab_access.log <==
91.231.40.197 - - [08/Jun/2018:13:05:36 +0000] "GET /import/gitlab/status HTTP/2.0" 302 295 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36"

==> /var/log/gitlab/gitlab-monitor/current <==
2018-06-08_13:05:36.36867 127.0.0.1 - - [08/Jun/2018:13:05:36 UTC] "GET /process HTTP/1.1" 200 1533
2018-06-08_13:05:36.36881 - -> /process

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/import/gitlab/callback?code=[FILTERED]" for 91.231.40.197 at 2018-06-08 13:05:37 +0000
Processing by Import::GitlabController#callback as HTML
  Parameters: {"code"=>"[FILTERED]"}
Redirected to https://development.zazmic.com/import/gitlab/status
Completed 302 Found in 162ms (ActiveRecord: 1.2ms | Elasticsearch: 0.0ms)

==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/import/gitlab/callback","format":"html","controller":"Import::GitlabController","action":"callback","status":302,"duration":162.81,"view":0.0,"db":1.17,"location":"https://development.zazmic.com/import/gitlab/status","time":"2018-06-08T13:05:37.217Z","params":[{"key":"code","value":"[FILTERED]"}],"remote_ip":"91.231.40.197","user_id":1,"username":"root"}

==> /var/log/gitlab/gitlab-workhorse/current <==
2018-06-08_13:05:37.38178 development.zazmic.com @ - - [2018/06/08:13:05:37 +0000] "GET /import/gitlab/callback?code=84083d4d8426b6d114f5ecd005690aef5e3d11fa726cf80307092081898260fc HTTP/1.1" 302 117 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36" 0.175

==> /var/log/gitlab/nginx/gitlab_access.log <==
91.231.40.197 - - [08/Jun/2018:13:05:37 +0000] "GET /import/gitlab/callback?code=84083d4d8426b6d114f5ecd005690aef5e3d11fa726cf80307092081898260fc HTTP/2.0" 302 117 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36"

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/import/gitlab/status" for 91.231.40.197 at 2018-06-08 13:05:37 +0000
Processing by Import::GitlabController#status as HTML
Redirected to https://gitlab.com/oauth/authorize?client_id=4916e1de15c3bce0ddde495712d9a10237db4c4184573fe965952c74715791db&redirect_uri=https%3A%2F%2Fdevelopment.zazmic.com%2Fimport%2Fgitlab%2Fcallback&response_type=code&scope=api
Completed 302 Found in 113ms (ActiveRecord: 1.9ms | Elasticsearch: 0.0ms)

==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/import/gitlab/status","format":"html","controller":"Import::GitlabController","action":"status","status":302,"duration":115.7,"view":0.0,"db":1.9,"location":"https://gitlab.com/oauth/authorize","time":"2018-06-08T13:05:37.574Z","params":[],"remote_ip":"91.231.40.197","user_id":1,"username":"root"}

==> /var/log/gitlab/gitlab-workhorse/current <==
2018-06-08_13:05:37.69227 development.zazmic.com @ - - [2018/06/08:13:05:37 +0000] "GET /import/gitlab/status HTTP/1.1" 302 295 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36" 0.126

Results of GitLab environment info

sudo gitlab-rake gitlab:env:info:

System information
System:         Ubuntu 16.04
Proxy:          no
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.4-ee
Revision:       f80a528
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
DB Version:     9.6.8
URL:            https://development.zazmic.com
HTTP Clone URL: https://development.zazmic.com/some-group/some-project.git
SSH Clone URL:  git@development.zazmic.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: gitlab

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

sudo gitlab-rake gitlab:check SANITIZE=true:

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: ... can't check, you have no projects
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? ... yes
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: ... can't check, you have no projects
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: ... 8
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Possible fixes

No idea...

Thank you!

Edited by ValeriyaP