<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Using GitLab CI/CD with a GitHub repository > 原文:[https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/github_integration.html](https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/github_integration.html) * [Connect with Personal Access Token](#connect-with-personal-access-token) * [Connect manually](#connect-manually) # Using GitLab CI/CD with a GitHub repository[](#using-gitlab-cicd-with-a-github-repository-premium "Permalink") 通過創建[CI / CD 項目](index.html)將 GitHub 存儲庫連接到 GitLab,GitLab CI / CD 可與**GitHub.com**和**GitHub Enterprise**一起使用. 觀看有關在[GitHub 存儲庫中使用 GitLab CI / CD 管道](https://www.youtube.com/watch?v=qgl3F2j-1cI)的視頻. **注意:**由于[GitHub 的限制](https://gitlab.com/gitlab-org/gitlab/-/issues/9147) ,不能將[GitHub OAuth](../../integration/github.html#enabling-github-oauth)用于作為外部 CI / CD 存儲庫的 GitHub 進行身份驗證. ## Connect with Personal Access Token[](#connect-with-personal-access-token "Permalink") **注意:**個人訪問令牌只能用于將 GitHub.com 存儲庫連接到 GitLab,并且 GitHub 用戶必須具有[owner 角色](https://help.github.com/en/github/getting-started-with-github/access-permissions-on-github) . 要通過 GitHub 一次性授權以授予 GitLab 訪問您的存儲庫的權限,請執行以下操作: 1. 打開[https://github.com/settings/tokens/new](https://github.com/settings/tokens/new)來創建**個人訪問令牌** . 該令牌將用于訪問您的存儲庫并將提交狀態推送到 GitHub. 應該啟用`repo`和`admin:repo_hook`以允許 GitLab 訪問您的項目,更新提交狀態并創建 Web 掛鉤以將新提交通知 GitLab. 2. 在 GitLab 中,轉到[新項目頁面](../../gitlab-basics/create-project.html#create-a-project-in-gitlab) ,選擇**CI / CD 作為外部倉庫**選項卡,然后單擊**GitHub** . 3. 將令牌粘貼到" **個人訪問令牌"**字段中,然后單擊" **列出存儲庫"** . 單擊" **連接"**以選擇存儲庫. 4. 在 GitHub 中,添加`.gitlab-ci.yml`以[配置 GitLab CI / CD](../quick_start/README.html) . GitLab 將: 1. 導入項目. 2. Enable [Pull Mirroring](../../user/project/repository/repository_mirroring.html#pulling-from-a-remote-repository-starter) 3. Enable [GitHub project integration](../../user/project/integrations/github.html) 4. 在 GitHub 上創建一個 Web 掛鉤,以通知 GitLab 新提交. ## Connect manually[](#connect-manually "Permalink") **注意:**要將**GitHub Enterprise**與**GitLab.com 一起**使用,請使用此方法. 要為您的存儲庫手動啟用 GitLab CI / CD: 1. 在 GitHub 中打開[https://github.com/settings/tokens/new](https://github.com/settings/tokens/new)創建**個人訪問令牌.** GitLab 將使用此令牌訪問您的存儲庫并推送提交狀態. 輸入**令牌描述**并更新范圍以允許: `repo`以便 GitLab 可以訪問您的項目并更新提交狀態 2. 在 GitLab 中,使用 Git URL 選項和 GitHub 存儲庫的 HTTPS URL 創建一個**CI / CD 項目** . 如果您的項目是私人項目,請使用您剛創建的個人訪問令牌進行身份驗證. GitLab 將自動配置基于輪詢的拉鏡像. 3. 仍在 GitLab 中,從**"設置">"集成"**啟用[GitHub 項目](../../user/project/integrations/github.html) **集成.** 選中" **活動"**復選框以啟用集成,將您的個人訪問令牌和 HTTPS 存儲庫 URL 粘貼到表單中,然后**保存.** 4. 仍在 GitLab 中,創建具有`API`范圍的**個人訪問令牌** ,以驗證 GitHub Web 掛鉤,以通知 GitLab 新提交. 5. 在 GitHub 中的**"設置">" Webhooks"中**創建一個 Web 掛鉤,以通知 GitLab 新提交. 應使用我們剛剛創建的 GitLab 個人訪問令牌,將 Web 掛鉤 URL 設置為 GitLab API 來[觸發拉鏡像](../../api/projects.html#start-the-pull-mirroring-process-for-a-project-starter) : ``` https://gitlab.com/api/v4/projects/<NAMESPACE>%2F<PROJECT>/mirror/pull?private_token=<PERSONAL_ACCESS_TOKEN> ``` 選擇" **讓我選擇單個事件"**選項,然后選中" **拉**取**請求**和**推送"**復選框. [對于外部拉取請求的管道,](index.html#pipelines-for-external-pull-requests)需要這些設置. 6. 在 GitHub 中添加`.gitlab-ci.yml`以配置 GitLab CI / CD.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看