<commit_before># GitHub import

>**Note:**
>
>  - [Introduced][ce-10308] in GitLab 9.1.
>  - You need a personal access token in order to retrieve and import GitHub
>    projects. You can get it from: https://github.com/settings/tokens
>  - You also need to pass an username as the second argument to the rake task
>    which will become the owner of the project.
>  - You can also resume an import with the same command.

To import a project from the list of your GitHub projects available:

```bash
# Omnibus installations
sudo gitlab-rake import:github[access_token,root,foo/bar]

# Installations from source
bundle exec rake import:github[access_token,root,foo/bar] RAILS_ENV=production
```

In this case, `access_token` is your GitHub personal access token, `root`
is your GitLab username, and  `foo/bar` is the new GitLab namespace/project that
will get created from your GitHub project. Subgroups are also possible: `foo/foo/bar`.


To import a specific GitHub project (named `foo/github_repo` here):

```bash
# Omnibus installations
sudo gitlab-rake import:github[access_token,root,foo/bar,foo/github_repo]

# Installations from source
bundle exec rake import:github[access_token,root,foo/bar,foo/github_repo] RAILS_ENV=production
```

[ce-10308]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10308



## Troubleshooting

* Syntax is very specific. Remove spaces within argument block and prior to brackets

```
# Success
sudo gitlab-rake import:github[access_token,root,foo/bar]

# Fail
sudo gitlab-rake import:github[access_token, root, foo/bar]
rake aborted!
Don't know how to build task 'import:github[access_token, root, foo/bar,' (see --tasks)
```

* Some shells can interpret the open/close brackets (`[]`) separately (ex: zsh). You may need to escape the brackets or switch shells

```
zsh: no matches found: import:github[token,root,foo/project,group/repository]
```
<commit_msg>Refactor GitHub import raketask docs<commit_after># GitHub import

>  [Introduced]( https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10308) in GitLab 9.1.

In order to retrieve and import GitHub repositories, you will need a
[GitHub personal access token](https://github.com/settings/tokens).
A username should be passed as the second argument to the rake task
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
before/after the brackets. Also, Some shells (e.g., zsh) can interpret the open/close brackets
(`[]`) separately. You may need to either escape the brackets or use double quotes.

## Importing multiple projects

To import a project from the list of your GitHub projects available:

```bash
# Omnibus installations
sudo gitlab-rake "import:github[access_token,root,foo/bar]"

# Installations from source
bundle exec rake "import:github[access_token,root,foo/bar]" RAILS_ENV=production
```

In this case, `access_token` is your GitHub personal access token, `root`
is your GitLab username, and  `foo/bar` is the new GitLab namespace/project that
will get created from your GitHub project. Subgroups are also possible: `foo/foo/bar`.

## Importing a single project

To import a specific GitHub project (named `foo/github_repo` here):

```bash
# Omnibus installations
sudo gitlab-rake "import:github[access_token,root,foo/bar,foo/github_repo]"

# Installations from source
bundle exec rake "import:github[access_token,root,foo/bar,foo/github_repo]" RAILS_ENV=production
```

{'fraction_non_alphanumeric': 0.09374114981591618, 'fraction_numerical': 0.006796941376380629, 'mean_word_length': 5.131944444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7240186', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1026, 'n_words': 401}