2017-04-06 12:47:40 +00:00
|
|
|
# GitHub import
|
|
|
|
|
2020-02-06 15:09:11 +00:00
|
|
|
> [Introduced]( https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10308) in GitLab 9.1.
|
2018-10-09 13:06:29 +00:00
|
|
|
|
|
|
|
In order to retrieve and import GitHub repositories, you will need a
|
|
|
|
[GitHub personal access token](https://github.com/settings/tokens).
|
2020-03-31 12:08:09 +00:00
|
|
|
A username should be passed as the second argument to the Rake task
|
2018-10-09 13:06:29 +00:00
|
|
|
which will become the owner of the project. You can resume an import
|
|
|
|
with the same command.
|
|
|
|
|
|
|
|
Bear in mind that the syntax is very specific. Remove any spaces within the argument block and
|
2020-04-27 06:09:51 +00:00
|
|
|
before/after the brackets. Also, some shells (for example, `zsh`) can interpret the open/close brackets
|
2018-10-09 13:06:29 +00:00
|
|
|
(`[]`) separately. You may need to either escape the brackets or use double quotes.
|
|
|
|
|
|
|
|
## Importing multiple projects
|
2017-04-06 12:47:40 +00:00
|
|
|
|
|
|
|
To import a project from the list of your GitHub projects available:
|
|
|
|
|
2020-01-30 15:09:15 +00:00
|
|
|
```shell
|
2017-04-06 12:47:40 +00:00
|
|
|
# Omnibus installations
|
2018-10-09 13:06:29 +00:00
|
|
|
sudo gitlab-rake "import:github[access_token,root,foo/bar]"
|
2017-04-06 12:47:40 +00:00
|
|
|
|
|
|
|
# Installations from source
|
2018-10-09 13:06:29 +00:00
|
|
|
bundle exec rake "import:github[access_token,root,foo/bar]" RAILS_ENV=production
|
2017-04-06 12:47:40 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
In this case, `access_token` is your GitHub personal access token, `root`
|
2017-06-13 12:10:31 +00:00
|
|
|
is your GitLab username, and `foo/bar` is the new GitLab namespace/project that
|
2017-04-06 12:47:40 +00:00
|
|
|
will get created from your GitHub project. Subgroups are also possible: `foo/foo/bar`.
|
|
|
|
|
2018-10-09 13:06:29 +00:00
|
|
|
## Importing a single project
|
2017-04-06 12:47:40 +00:00
|
|
|
|
|
|
|
To import a specific GitHub project (named `foo/github_repo` here):
|
|
|
|
|
2020-01-30 15:09:15 +00:00
|
|
|
```shell
|
2017-04-06 12:47:40 +00:00
|
|
|
# Omnibus installations
|
2018-10-09 13:06:29 +00:00
|
|
|
sudo gitlab-rake "import:github[access_token,root,foo/bar,foo/github_repo]"
|
2017-04-06 12:47:40 +00:00
|
|
|
|
|
|
|
# Installations from source
|
2018-10-09 13:06:29 +00:00
|
|
|
bundle exec rake "import:github[access_token,root,foo/bar,foo/github_repo]" RAILS_ENV=production
|
2018-03-06 20:21:56 +00:00
|
|
|
```
|