【发布时间】:2022-01-04 06:33:39
【问题描述】:
我在 GitHub 上有多个存储库,现在我将它们转移到 GitLab。
我的开发人员在 GitHub 文件上提交更改。
现在,有什么解决方案可以使在 GitHub 上提交的更改也会更改 GitLab 上的文件?
【问题讨论】:
标签: git github gitlab github-actions
我在 GitHub 上有多个存储库,现在我将它们转移到 GitLab。
我的开发人员在 GitHub 文件上提交更改。
现在,有什么解决方案可以使在 GitHub 上提交的更改也会更改 GitLab 上的文件?
【问题讨论】:
标签: git github gitlab github-actions
如果在“转移”时,这些存储库从本地 GitHub 副本推送到 GitLab,则它们共享一个共同的历史记录。
这意味着,从本地 GitLab 克隆中,您可以:
cd /path/to/GitLab/local/clone
git remote add github https://github.com/old/project
git fetch github
git merge github/main
git push
正如评论的那样,另一种方法是让您的开发人员发送到push both to GitHub and GitLab,假设该开发人员是唯一一个在两个存储库中的当前分支上工作的人(或者它在向两个存储库进行任何推送之前开始涉及复杂的同步步骤)
# For developer working on GitHub
cd /path/to/GitHub/local/clone
git remote set-url origin --push --add https://github.com/old/project
git remote set-url origin --push --add https://gitlab.com/new/project
# work: add and commit
git push
【讨论】: