The GitLab rake task can import a single project or multiple projects at once. It is invoked from the command line, so you need administrator access to the machine where the GitLab application is running.
When specifying a GitHub repository as the fourth argument to the rake task, you can directly import it.
To import a specific GitHub project (named joustie/github_repo here), do the following:
- Omnibus installations:
sudo gitlab-rake "import:github[<personal_access_token>,<gitlab user>,<namespace/project>,<source_namespace/github_repo>]"
- Installations from source:
bundle exec rake "import:github[<personal_access_token>,<gitlab user>,<namespace/project>,<source_namespace/github_repo>]" RAILS_ENV=production
To import a project from the list of your available GitHub projects, do the following:
- Omnibus installations:
sudo gitlab-rake "import:github[<personal_access_token>,<gitlab user>,<namespace/project>]"
- Installations from source:
bundle exec rake "import:github[<personal_access_token>,<gitlab user>,<namespace/project>]" RAILS_ENV=production
It is also possible to specify subgroups such as <groupname/groupname/project>.
For my example project, you will see the following results:
The GitHub importer obtained a list of projects with your GitHub personal access token. When you want to specify one particular project, use the ID:
The importer will ask for confirmation after that:
The rake tasks will run synchronously and perform the import. After the import operation, a summary of the timings is given:
When you log in to your GitLab instance, you will find the imported project.