debian-mirror-gitlab/doc/administration/raketasks/github_import.md

47 lines
1.8 KiB
Markdown
Raw Normal View History

2020-05-24 23:13:21 +05:30
# GitHub import **(CORE ONLY)**
2017-08-17 22:00:37 +05:30
2020-03-13 15:44:24 +05:30
> [Introduced]( https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10308) in GitLab 9.1.
2018-12-13 13:39:08 +05:30
In order to retrieve and import GitHub repositories, you will need a
[GitHub personal access token](https://github.com/settings/tokens).
2020-04-22 19:07:51 +05:30
A username should be passed as the second argument to the Rake task
2018-12-13 13:39:08 +05:30
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-05-24 23:13:21 +05:30
before/after the brackets. Also, some shells (for example, `zsh`) can interpret the open/close brackets
2018-12-13 13:39:08 +05:30
(`[]`) separately. You may need to either escape the brackets or use double quotes.
2020-06-23 00:09:42 +05:30
## Caveats
If the GitHub [rate limit](https://developer.github.com/v3/#rate-limiting) is reached while importing,
the importing process will wait (`sleep()`) until it can continue importing.
2018-12-13 13:39:08 +05:30
## Importing multiple projects
2017-08-17 22:00:37 +05:30
To import a project from the list of your GitHub projects available:
2020-03-13 15:44:24 +05:30
```shell
2017-08-17 22:00:37 +05:30
# Omnibus installations
2018-12-13 13:39:08 +05:30
sudo gitlab-rake "import:github[access_token,root,foo/bar]"
2017-08-17 22:00:37 +05:30
# Installations from source
2018-12-13 13:39:08 +05:30
bundle exec rake "import:github[access_token,root,foo/bar]" RAILS_ENV=production
2017-08-17 22:00:37 +05:30
```
In this case, `access_token` is your GitHub personal access token, `root`
2017-09-10 17:25:29 +05:30
is your GitLab username, and `foo/bar` is the new GitLab namespace/project that
2017-08-17 22:00:37 +05:30
will get created from your GitHub project. Subgroups are also possible: `foo/foo/bar`.
2018-12-13 13:39:08 +05:30
## Importing a single project
2017-08-17 22:00:37 +05:30
To import a specific GitHub project (named `foo/github_repo` here):
2020-03-13 15:44:24 +05:30
```shell
2017-08-17 22:00:37 +05:30
# Omnibus installations
2018-12-13 13:39:08 +05:30
sudo gitlab-rake "import:github[access_token,root,foo/bar,foo/github_repo]"
2017-08-17 22:00:37 +05:30
# Installations from source
2018-12-13 13:39:08 +05:30
bundle exec rake "import:github[access_token,root,foo/bar,foo/github_repo]" RAILS_ENV=production
2017-08-17 22:00:37 +05:30
```