<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Repository mirroring > 原文:[https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html](https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html) * [Overview](#overview) * [Use cases](#use-cases) * [Pushing to a remote repository](#pushing-to-a-remote-repository-core) * [Configuring push mirrors through the API](#configuring-push-mirrors-through-the-api) * [Push only protected branches](#push-only-protected-branches-core) * [Keep divergent refs](#keep-divergent-refs-core) * [Setting up a push mirror from GitLab to GitHub](#setting-up-a-push-mirror-from-gitlab-to-github-core) * [Setting up a push mirror to another GitLab instance with 2FA activated](#setting-up-a-push-mirror-to-another-gitlab-instance-with-2fa-activated) * [Pulling from a remote repository](#pulling-from-a-remote-repository-starter) * [How it works](#how-it-works) * [SSH authentication](#ssh-authentication) * [SSH public key authentication](#ssh-public-key-authentication) * [Overwrite diverged branches](#overwrite-diverged-branches-starter) * [Only mirror protected branches](#only-mirror-protected-branches-starter) * [Hard failure](#hard-failure-starter) * [Trigger update using API](#trigger-update-using-api-starter) * [Forcing an update](#forcing-an-update-core) * [Bidirectional mirroring](#bidirectional-mirroring-starter) * [Configure a webhook to trigger an immediate pull to GitLab](#configure-a-webhook-to-trigger-an-immediate-pull-to-gitlab) * [Preventing conflicts using a `pre-receive` hook](#preventing-conflicts-using-a-pre-receive-hook) * [Mirroring with Perforce Helix via Git Fusion](#mirroring-with-perforce-helix-via-git-fusion-starter) * [Troubleshooting](#troubleshooting) * [13:Received RST_STREAM with error code 2 with GitHub](#13received-rst_stream-with-error-code-2-with-github) # Repository mirroring[](#repository-mirroring "Permalink") 存儲庫鏡像允許將存儲庫鏡像到外部源或從外部源鏡像. 它可用于鏡像存儲庫之間的分支,標簽和提交. GitLab 上的存儲庫鏡像將自動更新. 您也可以最多每 5 分鐘手動觸發一次更新. ## Overview[](#overview "Permalink") 當您想在 GitLab 之外使用存儲庫時,存儲庫鏡像很有用. GitLab 支持兩種存儲庫鏡像: * 推送:用于將 GitLab 存儲庫鏡像到另一個位置. * Pull: for mirroring a repository from another location to GitLab. 鏡像存儲庫更新后,所有新的分支,標記和提交將在項目的活動提要中可見. 至少具有[開發人員訪問](../../permissions.html)項目[權限](../../permissions.html)的用戶也可以強制立即更新,除非: * 鏡像已被更新. * 自上次更新以來,還沒有過去 5 分鐘. 出于安全原因,在[GitLab 12.10 和更高版本中](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27166) ,原始存儲庫的 URL 僅顯示給對鏡像項目具有維護者或所有者權限的用戶. ## Use cases[](#use-cases "Permalink") 以下是存儲庫鏡像的一些可能的用例: * 您遷移到了 GitLab,但仍需要將項目保留在另一個源中. 在這種情況下,您只需將其設置為鏡像到 GitLab(拉),所有提交,標簽和分支的基本歷史記錄都將在您的 GitLab 實例中提供. * 您在另一個源中有舊項目,這些舊項目不再使用,但又不想出于歸檔目的而刪除它們. 在這種情況下,您可以創建一個推送鏡像,以便您的活動 GitLab 存儲庫可以將其更改推送到舊位置. ## Pushing to a remote repository[](#pushing-to-a-remote-repository-core "Permalink") 版本歷史 * 在 GitLab 企業版 8.7 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/249) . * 在 10.8 版中[移至 GitLab Core](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18715) . 對于現有項目,可以按如下所示設置推送鏡像: 1. 導航到項目的**"設置">"存儲庫",**然后展開" **鏡像存儲庫"**部分. 2. 輸入存儲庫 URL. 3. 從**鏡像方向**下拉菜單中選擇**推送** . 4. 如有必要,請從" **身份驗證方法"**下拉列表中選擇一種身份**驗證方法** . 5. 如有必要,請選中**僅鏡像保護的分支**框. 6. 如果需要, **請**選中" **保持差異引用"**框. 7. 單擊**鏡像存儲庫**按鈕以保存配置. [![Repository mirroring push settings screen](https://img.kancloud.cn/8b/cb/8bcb9650c097a7c033d281601a34be40_973x704.png)](img/repository_mirroring_push_settings.png) 啟用推送鏡像后,只有推送會直接提交到鏡像存儲庫,以防止鏡像發散. 任何時候,所有更改都將最終存儲在鏡像存儲庫中: * 提交被推送到 GitLab. * [強制更新](#forcing-an-update-core)已啟動. 推送到存儲庫中文件的更改至少會自動推送到遠程鏡像: * 收到后五分鐘內. * 如果啟用了**僅受鏡像保護的分支,**則在一分鐘之內. 如果分支分支不同,您將在" **鏡像存儲庫"**部分看到指示的錯誤. ### Configuring push mirrors through the API[](#configuring-push-mirrors-through-the-api "Permalink") 您還可以通過[遠程鏡像 API](../../../api/remote_mirrors.html)創建和修改項目推送鏡像. ### Push only protected branches[](#push-only-protected-branches-core "Permalink") 版本歷史 * 在[GitLab Starter](https://about.gitlab.com/pricing/) 10.3 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3350) . * 在 10.8 版中[移至 GitLab Core](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18715) . 您可以選擇僅將受保護的分支從 GitLab 推送到遠程存儲庫. 要使用此選項,請在創建存儲庫鏡像時選中" **僅鏡像保護的分支"**框. ### Keep divergent refs[](#keep-divergent-refs-core "Permalink") 在 GitLab 13.0 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/208828) . 默認情況下,如果遠程鏡像上的任何引用都與本地存儲庫不同,則*整個推送*將失敗,并且不會更新任何內容. 例如,如果存儲庫具有已鏡像到遠程的`master` , `develop`和`stable`分支,然后添加新提交以在鏡像上進行`develop` ,則下一次推送嘗試將失敗,從而使`master`和`stable`不在可用范圍內約會盡管沒有分歧. 在解決分歧之前,無法反映任何分支上的更改. 啟用" **保持差異引用"**選項后,將跳過`develop`分支,從而可以更新`master`和`stable` . 鏡像狀態將反映`develop`已偏離并被跳過,并標記為更新失敗. **注意:**創建鏡像后,當前只能通過[API](../../../api/remote_mirrors.html)修改此選項. ## Setting up a push mirror from GitLab to GitHub[](#setting-up-a-push-mirror-from-gitlab-to-github-core "Permalink") 要設置從 GitLab 到 GitHub 的鏡像,您需要執行以下步驟: 1. 創建一個[GitHub 個人訪問令牌](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) ,并選中`public_repo`框. 2. 使用以下格式填寫**Git 存儲庫 URL**字段: `https://<your_github_username>@github.com/<your_github_group>/<your_github_project>.git` . 3. 使用您的 GitHub 個人訪問令牌填寫**密碼**字段. 4. 單擊**鏡像存儲庫**按鈕. 鏡像的存儲庫將被列出. 例如, `https://*****:*****@github.com/<your_github_group>/<your_github_project>.git` . 該存儲庫將很快推送. 要強制按下,請單擊適當的按鈕. ## Setting up a push mirror to another GitLab instance with 2FA activated[](#setting-up-a-push-mirror-to-another-gitlab-instance-with-2fa-activated "Permalink") 1. 在目標 GitLab 實例上,創建一個具有`write_repository`范圍的[個人訪問令牌](../../profile/personal_access_tokens.html) . 2. 在源 GitLab 實例上: 1. 使用以下格式填寫**Git 存儲庫 URL**字段: `https://oauth2@<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git` . 2. 在目標 GitLab 實例上創建的 GitLab 個人訪問令牌中填寫**密碼**字段. 3. 單擊**鏡像存儲庫**按鈕. ## Pulling from a remote repository[](#pulling-from-a-remote-repository-starter "Permalink") 版本歷史 * 在 GitLab 企業版 8.2 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51) . * 在[GitLab Starter](https://about.gitlab.com/pricing/) 11.11 中[添加了 Git LFS 支持](https://gitlab.com/gitlab-org/gitlab/-/issues/10871) . 您可以將存儲庫設置為自動從上游存儲庫更新其分支,標記和提交. 當您感興趣的存儲庫位于其他服務器上并且您希望能夠使用熟悉的 GitLab 界面瀏覽其內容和活動時,此功能很有用. 要為現有項目配置鏡像拉出: 1. Navigate to your project’s **設置>存儲庫** and expand the **鏡像存儲庫** section. 2. 輸入存儲庫 URL. 3. 從**鏡像方向**下拉菜單中選擇**拉** . 4. 如有必要,請從" **身份驗證方法"**下拉列表中選擇一種身份**驗證方法** . 5. 如有必要,請選中以下框: * **覆蓋分散的分支** . * **觸發管道以更新鏡像** . * **僅鏡像保護的分支** . 6. 單擊**鏡像存儲庫**按鈕以保存配置. [![Repository mirroring pull settings screen - upper part](https://img.kancloud.cn/5c/f0/5cf0a9c1befee8eaafa1671d36b8e4a4_1740x1321.png)](img/repository_mirroring_pull_settings_upper.png) * * * [![Repository mirroring pull settings screen - lower part](https://img.kancloud.cn/b2/6f/b26ff1cfea4fdf350dc81d10c45ad2ce_1740x856.png)](img/repository_mirroring_pull_settings_lower.png) Because GitLab is now set to pull changes from the upstream repository, you should not push commits directly to the repository on GitLab. Instead, any commits should be pushed to the upstream repository. Changes pushed to the upstream repository will be pulled into the GitLab repository, either: * 在一定時間內自動. * 啟動[強制更新時](#forcing-an-update-core) . **警告:**如果您確實在 GitLab 存儲庫中更新了分支,則該分支將與上游分叉,并且 GitLab 將不再自動更新該分支以防止丟失任何更改. 另請注意,上游存儲庫中已刪除的分支和標簽將不會反映在 GitLab 存儲庫中. ### How it works[](#how-it-works "Permalink") 為存儲庫啟用拉鏡像功能后,會將存儲庫添加到隊列中. 每分鐘一次,Sidekiq cron 作業基于以下內容計劃存儲庫鏡像的更新: * 可用容量. 這由 Sidekiq 設置確定. 對于 GitLab.com,請參閱[GitLab.com Sidekiq 設置](../../gitlab_com/index.html#sidekiq) . * 隊列中已經要更新的存儲庫鏡像數. 到期時間取決于存儲庫鏡像的最后更新時間以及重試次數. 隨著 Sidekiq 可以處理存儲庫鏡像,它們也會更新. 如果更新存儲庫鏡像的過程為: * 成功后,至少需要等待 30 分鐘,更新才會重新加入隊列. * 失敗(例如,分支從上游分支),稍后將再次嘗試. 鏡像最多可以發生 14 次故障,然后才不會再次進入隊列進行更新. ### SSH authentication[](#ssh-authentication "Permalink") > * 在[GitLab Starter](https://about.gitlab.com/pricing/) 9.5 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/2551)了拉鏡像. > * 在[GitLab Core](https://about.gitlab.com/pricing/) 11.6 中為推送鏡像[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22982) SSH 身份驗證是相互的: * 您必須向服務器證明您有權訪問存儲庫. * 服務器還必須向*您*證明它是誰. 您提供憑據作為密碼或公共密鑰. 另一個存儲庫所在的服務器提供其憑據作為"主機密鑰",其指紋需要手動驗證. 如果您通過 SSH 鏡像(即使用`ssh://` URL),則可以使用以下方法進行身份驗證: * 基于密碼的身份驗證,就像通過 HTTPS 一樣. * 公鑰認證. 這通常比密碼身份驗證更安全,尤其是當其他存儲庫支持[Deploy Keys 時](../../../ssh/README.html#deploy-keys) . 開始: 1. 導航到項目的**"設置">"存儲庫",**然后展開" **鏡像存儲庫"**部分. 2. 輸入`ssh://` URL 進行鏡像. **注意:**目前不支持 SCP 樣式的 URL(即`git@example.com:group/project.git` ). 輸入 URL 在頁面上添加兩個按鈕: * **檢測主機密鑰**. * **手動輸入主機密鑰**. 如果單擊: * **檢測主機密鑰**按鈕,GitLab 將從服務器獲取主機密鑰并顯示指紋. * **手動輸入主機密鑰**按鈕,將顯示一個字段,您可以在其中粘貼主機密鑰. 假設您使用了前者,那么現在需要驗證指紋是否符合您的期望. GitLab.com 和其他代碼托管站點公開公開其指紋,供您檢查: * [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/regions.html#regions-fingerprints) * [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/) * [GitHub](https://help.github.com/en/github/authenticating-to-github/githubs-ssh-key-fingerprints) * [GitLab.com](../../gitlab_com/index.html#ssh-host-keys-fingerprints) * [Launchpad](https://help.launchpad.net/SSHFingerprints) * [Savannah](http://savannah.gnu.org/maintenance/SshAccess/) * [SourceForge](https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/) 其他提供者將有所不同. 如果您正在運行自我管理的 GitLab,或者可以訪問其他存儲庫的服務器,則可以安全地收集密鑰指紋: ``` $ cat /etc/ssh/ssh_host*pub | ssh-keygen -E md5 -l -f - 256 MD5:f4:28:9f:23:99:15:21:1b:bf:ed:1f:8e:a0:76:b2:9d root@example.com (ECDSA) 256 MD5:e6:eb:45:8a:3c:59:35:5f:e9:5b:80:12:be:7e:22:73 root@example.com (ED25519) 2048 MD5:3f:72:be:3d:62:03:5c:62:83:e8:6e:14:34:3a:85:1d root@example.com (RSA) ``` **注意:**對于某些舊版本的 SSH,可能需要排除`-E md5` . 在鏡像存儲庫時,GitLab 現在將在連接之前檢查至少一個存儲的主機密鑰是否匹配. 這樣可以防止將惡意代碼注入到您的鏡像中,或者防止您的密碼被盜. ### SSH public key authentication[](#ssh-public-key-authentication "Permalink") 要使用 SSH 公鑰身份驗證,您還需要從**Authentication method**下拉菜單中選擇該選項. 創建鏡像后,GitLab 會生成一個 4096 位 RSA 密鑰,可以通過單擊" **復制 SSH"公共密鑰**按鈕進行復制. [![Repository mirroring copy SSH public key to clipboard button](https://img.kancloud.cn/b3/1f/b31f205054a24bccc9fd9508947eae72_1539x261.png)](img/repository_mirroring_copy_ssh_public_key_button.png) 然后,您需要將公共 SSH 密鑰添加到另一個存儲庫的配置中: * 如果其他存儲庫托管在 GitLab 上,則應將公共 SSH 密鑰添加為[Deploy Key](../../../ssh/README.html#deploy-keys) . * 如果其他存儲庫位于其他位置,則可能需要將密鑰添加到用戶的`authorized_keys`文件中. 將整個公共 SSH 密鑰單獨粘貼到文件中并保存. 如果您需要隨時更改密鑰,則可以刪除并重新添加鏡像以生成新密鑰. 您必須使用新密鑰更新另一個存儲庫,以保持鏡像運行. **注意:**生成的密鑰存儲在 GitLab 數據庫中,而不存儲在文件系統中. 因此,無法在預接收掛鉤中使用針對鏡像的 SSH 公鑰身份驗證. ### Overwrite diverged branches[](#overwrite-diverged-branches-starter "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4559) in [GitLab Starter](https://about.gitlab.com/pricing/) 10.6. 您可以選擇始終使用遠程版本更新本地分支,即使它們與遠程分支不同. **警告:**對于鏡像分支,啟用此選項會導致丟失本地更改. 要使用此選項,請在創建存儲庫鏡像時選中" **覆蓋分支分支"**框. ### Only mirror protected branches[](#only-mirror-protected-branches-starter "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3326) in [GitLab Starter](https://about.gitlab.com/pricing/) 10.3. 您可以選擇僅將受保護的分支從遠程存儲庫拉到 GitLab. 未受保護的分支不會被鏡像,并且可能會分開. 要使用此選項,請在創建存儲庫鏡像時選中" **僅鏡像保護的分支"**框. ### Hard failure[](#hard-failure-starter "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3117) in [GitLab Starter](https://about.gitlab.com/pricing/) 10.2. 如果鏡像過程連續 14 次失敗重試,它將被標記為硬盤失敗. 這將在以下任一位置中可見: * 項目的主要儀表板. * 拉鏡設置頁面. 當一個項目很難失敗時,它將不再需要進行鏡像. 用戶可以通過[強制更新來](#forcing-an-update-core)再次恢復項目鏡像. ### Trigger update using API[](#trigger-update-using-api-starter "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3453) in [GitLab Starter](https://about.gitlab.com/pricing/) 10.3. 拉鏡像使用輪詢來檢測新添加的分支和提交,通常是在幾分鐘后. 如果您通過[API](../../../api/projects.html#start-the-pull-mirroring-process-for-a-project-starter)通知 GitLab,更新將立即被拉出. 有關更多信息,請參閱[啟動項目的拉鏡像過程](../../../api/projects.html#start-the-pull-mirroring-process-for-a-project-starter) . ## Forcing an update[](#forcing-an-update-core "Permalink") 當計劃將鏡像自動更新時,您始終可以使用" **存儲** **庫設置"**頁面的" **鏡像存儲庫"**部分上的"更新"按鈕強制進行更新. [![Repository mirroring force update user interface](https://img.kancloud.cn/de/5e/de5e9ab56e6ef8ad0ccbda74a21881f1_1722x272.png)](img/repository_mirroring_force_update.png) ## Bidirectional mirroring[](#bidirectional-mirroring-starter "Permalink") **注意:**雙向鏡像可能會導致沖突. 如果您將 GitLab 存儲庫配置為從同一遠程源中拉出和推送到同一遠程源,則不能保證這兩個存儲庫都將正確更新. 如果為雙向鏡像設置存儲庫,則應通過確定誰將解決它們以及如何解決它們來為可能的沖突做準備. 重寫任一遠程上的任何鏡像提交將導致沖突,并且鏡像失敗. 可以通過以下方法防止此情況: * [Pulling only protected branches](#only-mirror-protected-branches-starter). * [Pushing only protected branches](#push-only-protected-branches-core). 您應該[保護](../protected_branches.html)希望在兩個遠程控制器上鏡像[的分支](../protected_branches.html) ,以防止由于重寫歷史記錄而引起的沖突. 雙向鏡像還會創建競態條件,在這種競態條件中,靠近同一分支的提交會引起沖突. 通過使用[Push 事件 Webhook](../integrations/webhooks.html#push-events)觸發立即拉到 GitLab,可以通過減少鏡像延遲來緩解競爭狀況. 當僅推送鏡像受保護的分支時,來自 GitLab 的推送鏡像的速率限制為每分鐘一次. ### Configure a webhook to trigger an immediate pull to GitLab[](#configure-a-webhook-to-trigger-an-immediate-pull-to-gitlab "Permalink") 假設您已經在上游 GitLab 實例中配置了[推](#setting-up-a-push-mirror-to-another-gitlab-instance-with-2fa-activated)和[拉](#pulling-from-a-remote-repository-starter)鏡像,以觸發如上所述的立即提拉,則需要在下游實例中配置一個[推事件 Web 掛鉤](../integrations/webhooks.html#push-events) . 去做這個: * 創建具有`API`范圍的[個人訪問令牌](../../profile/personal_access_tokens.html) . * 導航到**設置> Webhooks** * 添加 webhook URL,在這種情況下,它將在存儲庫更新后使用[Pull Mirror API](../../../api/projects.html#start-the-pull-mirroring-process-for-a-project-starter)請求觸發即時提取. ``` https://gitlab.example.com/api/v4/projects/:id/mirror/pull?private_token=<your_access_token> ``` * 確保已選中" **推送事件"**復選框. * 單擊**添加 Webhook**按鈕以保存**Webhook** . * 要測試集成,請單擊" **測試"**按鈕,并確認 GitLab 不返回任何錯誤. ### Preventing conflicts using a `pre-receive` hook[](#preventing-conflicts-using-a-pre-receive-hook "Permalink") **警告:**提議的解決方案將對 Git 推送操作的性能產生負面影響,因為它們將被代理到上游 Git 存儲庫. 服務器端`pre-receive`掛鉤可通過僅在將提交首先推送到上游 Git 存儲庫之后才接受推送來防止上述競爭情況. 在此配置中,一個 Git 存儲庫充當權威的上游,另一個充當下游. `pre-receive`掛鉤將安裝在下游存儲庫中. 閱讀有關在 GitLab 服務器上[配置服務器掛鉤](../../../administration/server_hooks.html)的信息. 下面提供了一個樣品`pre-receive`掛鉤. ``` #!/usr/bin/env bash # --- Assume only one push mirror target # Push mirroring remotes are named `remote_mirror_<id>`, this finds the first remote and uses that. TARGET_REPO=$(git remote | grep -m 1 remote_mirror) proxy_push() { # --- Arguments OLDREV=$(git rev-parse $1) NEWREV=$(git rev-parse $2) REFNAME="$3" # --- Pattern of branches to proxy pushes allowlist=$(expr "$branch" : "\(master\)") case "$refname" in refs/heads/*) branch=$(expr "$refname" : "refs/heads/\(.*\)") if [ "$allowlist" = "$branch" ]; then unset GIT_QUARANTINE_PATH # handle https://git-scm.com/docs/git-receive-pack#_quarantine_environment error="$(git push --quiet $TARGET_REPO $NEWREV:$REFNAME 2>&1)" fail=$? if [ "$fail" != "0" ]; then echo >&2 "" echo >&2 " Error: updates were rejected by upstream server" echo >&2 " This is usually caused by another repository pushing changes" echo >&2 " to the same ref. You may want to first integrate remote changes" echo >&2 "" return fi fi ;; esac } # Allow dual mode: run from the command line just like the update hook, or # if no arguments are given then run as a hook script if [ -n "$1" -a -n "$2" -a -n "$3" ]; then # Output to the terminal in command line mode - if someone wanted to # resend an email; they could redirect the output to sendmail # themselves PAGER= proxy_push $2 $3 $1 else # Push is proxied upstream one ref at a time. Because of this it is possible # for some refs to succeed, and others to fail. This will result in a failed # push. while read oldrev newrev refname do proxy_push $oldrev $newrev $refname done fi ``` 請注意,此示例有一些限制: * 此示例可能無法完全滿足您的用例,并且可能需要進行修改. * 它不考慮鏡像的不同類型的身份驗證機制. * 它不適用于強制更新(重寫歷史記錄). * 僅匹配`allowlist`模式的分支將被代理推送. * 該腳本規避了 Git 鉤子隔離環境,因為`$TARGET_REPO`的更新被視為參考更新,Git 會對此進行抱怨. ### Mirroring with Perforce Helix via Git Fusion[](#mirroring-with-perforce-helix-via-git-fusion-starter "Permalink") **警告:**雙向鏡像不應用作永久配置. 有關替代的遷移方法,請參閱[從 Perforce Helix](../import/perforce.html)遷移. [Git Fusion](https://www.perforce.com/manuals/git-fusion/#Git-Fusion/section_avy_hyc_gl.html)為[Perforce Helix](https://www.perforce.com/products)提供了一個 Git 接口,GitLab 可以使用它來雙向鏡像 GitLab 項目. 從 Perforce Helix 遷移到 GitLab 的某些情況下,這可能是有用的,因為重疊的 Perforce Helix 工作區無法同時遷移到 GitLab. 如果將鏡像與 Perforce Helix 一起使用,則應僅鏡像受保護的分支. Perforce Helix 將拒絕任何重寫歷史記錄的推送. 由于 Git Fusion 的性能限制,只應鏡像最少數量的分支. 通過 Git Fusion 使用 Perforce Helix 配置鏡像時,建議使用以下 Git Fusion 設置: * `change-pusher`應禁用. 否則,每個提交都將被重寫為由鏡像帳戶提交,而不是映射到現有的 Perforce Helix 用戶或`unknown_git`用戶. * 如果 Perforce Helix 中不存在 GitLab 用戶,則`unknown_git`用戶將用作提交作者. [在 Perforce.com 上](https://www.perforce.com/manuals/git-fusion/Content/Git-Fusion/section_vss_bdw_w3.html#section_zdp_zz1_3l)了解有關[Git Fusion 設置的信息](https://www.perforce.com/manuals/git-fusion/Content/Git-Fusion/section_vss_bdw_w3.html#section_zdp_zz1_3l) . ## Troubleshooting[](#troubleshooting "Permalink") 如果在推送過程中發生錯誤,則 GitLab 將在該存儲庫中顯示"錯誤"突出顯示. 然后,將鼠標懸停在突出顯示的文本上,即可查看有關錯誤的詳細信息. ### 13:Received RST_STREAM with error code 2 with GitHub[](#13received-rst_stream-with-error-code-2-with-github "Permalink") 如果在鏡像到 GitHub 存儲庫時收到"錯誤代碼為 2 的 13:Received RST_STREAM",則您的 GitHub 設置可能被設置為阻止推送,以暴露用于提交的電子郵件地址. 可以將您在 GitHub 上的電子郵件地址設置為公開,或者禁用[公開我的電子郵件](https://github.com/settings/emails)設置的" [阻止"命令行推送](https://github.com/settings/emails) .
                  <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>

                              哎呀哎呀视频在线观看