【问题标题】:How to migrate gitlab rep for another project&如何为另一个项目迁移 gitlab 代表&
【发布时间】:2023-01-02 04:43:11
【问题描述】:

最近我们升级了硬件,我们想将带有历史记录的 repo 移动到另一个 gitlab 实例。但是我们遇到了一个问题。我堆积在必须通过 i push rep 为用户输入密码的步骤上。也许我理解错了?

例如。我在 gitlab.myDomain.com 上有代表“A”,想把它移到 git.myDomain.com 上的代表“B”(空白代表)

因此,我们希望在代表“B”上拥有与“A”相同的代表,其中包含所有历史记录和分支,因此没有人需要重新下载代表,他们只需要更改 URL 并获取代表(我们的回购协议很大,有些我们的团队没有良好的互联网连接,所以我们想防止重新下载)

我遵循 gitlab 指南

cd existing_repo
git remote rename origin old-origin
git remote add origin git@git.gamewheelstudio.ru:gamewheelstudio/Atrophia_Animation.git
git push -u origin --all
git push -u origin --tags

我已经尝试将 git@ 更改为 root@ 因为我没有使用“git”登录的帐户,但我的密码没有一个不多。

【问题讨论】:

  • 您是否在新实例上设置了 ssh 密钥? git@ 不是您的用户名,它只是使用 ssh 密钥的方式。
  • gitlab 上的文档说你可能想使用备份来移动它......

标签: git gitlab


【解决方案1】:

如果你想用历史迁移存储库,你应该使用镜像。

你可以通过这个脚本来做到这一点:

#!/bin/bash

IFS=,
GITLAB_NEW_PREFIX=git@gitlab-new.example.com/
GITLAB_OLD_PREFIX=git@gitlab-old.example.com/

REPOS=repo1,repo2,repo3

rm -rf ./*.git

for R in $REPOS;
do 
    git clone --mirror $GITLAB_OLD_PREFIX$R.git
    cd $R.git && git remote set-url origin $GITLAB_NEW_PREFIX$R && git push --mirror
    cd ..
done

【讨论】:

    猜你喜欢
    • 2021-05-28
    • 2018-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    相关资源
    最近更新 更多