🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# GitHub import > 原文:[https://docs.gitlab.com/ee/administration/raketasks/github_import.html](https://docs.gitlab.com/ee/administration/raketasks/github_import.html) * [Caveats](#caveats) * [Importing multiple projects](#importing-multiple-projects) * [Importing a single project](#importing-a-single-project) # GitHub import[](#github-import-core-only "Permalink") 在 GitLab 9.1 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10308) . 为了检索和导入 GitHub 存储库,您将需要一个[GitHub 个人访问令牌](https://github.com/settings/tokens) . 用户名应作为 Rake 任务的第二个参数传递,该任务将成为项目的所有者. 您可以使用相同的命令恢复导入. 请记住,语法非常具体. 删除参数块内以及方括号之前/之后的所有空格. 此外,某些外壳程序(例如`zsh` )可以分别解释开/关括号( `[]` ). 您可能需要转义括号或使用双引号. ## Caveats[](#caveats "Permalink") 如果在导入时达到 GitHub [速率限制](https://developer.github.com/v3/#rate-limiting) ,则导入过程将等待( `sleep()` ),直到可以继续导入为止. ## Importing multiple projects[](#importing-multiple-projects "Permalink") 要从可用的 GitHub 项目列表中导入项目,请执行以下操作: ``` # 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 ``` 在这种情况下, `access_token`是您的 GitHub 个人访问令牌, `root`是您的 GitLab 用户名,而`foo/bar`是将从您的 GitHub 项目创建的新 GitLab 名称空间/项目. 子组也是可能的: `foo/foo/bar` . ## Importing a single project[](#importing-a-single-project "Permalink") 要导入特定的 GitHub 项目(在此处名为`foo/github_repo` ): ``` # 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 ```