Importing from a GitHub Enterprise instance to GitLab.com may not be possible.

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Summary

The github_url method in the Gitlab::GithubImport::MarkdownText class returns either the OAuth provider url specified in the GitLab instance configuration file or https://github.com.

# Returns github domain without slash in the end
def github_url
  oauth_config = Gitlab::Auth::OAuth::Provider.config_for('github') || {}
  url = oauth_config['url'].presence || 'https://github.com'
  url = url.chop if url.end_with?('/')
  url
end

https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/github_import/markdown_text.rb?ref_type=heads#L35

In a scenario where a user is importing from a GitHub Enterprise Server Instance, or from a subdomain of GHE.com (e.g. octocorp.ghe.com an enterprise that uses GitHub Enterprise Cloud with data residency) to GitLab.com, even if they enter the :github_hostname in the POST request, the OAuth process is read from the github_url method described above, which on GitLab.com will always return github.com.

We therefore suspect that it is not possible to import from a GitHub Enterprise instance to GitLab.com as OAuth will fail.

Steps to reproduce

Example Project

What is the current bug behavior?

When a user makes a [POST request] to import from GitHub leaving OAuth config empty and specifying a hostname different to http://github.com, the method will nevertheless return http://github.com

What is the expected correct behavior?

The correct url should be returned.

Edited Sep 30, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading