想要将git存储库从git客户端迁移到另一台gitlab服务器

发布于 2025-02-06 02:12:18 字数 257 浏览 3 评论 0原文

我面临着一个情况, 我有两个不同的git实验室服务器,请考虑“ A”和“ B”。我将一个项目存储库从服务器“ A”提取到本地客户端。现在,我想将此本地存储库推向服务器“ B”。但是在此迁移期间,我也想保留所有先前的提交和配置,并保存在新服务器上。 (这意味着,我无法从本地数据上创建一个在“ B”的服务器“ B”上创建一个新的存储库)

注意:我丢失了对Git Server的访问权限“ A”,而只是在GIT客户端上拥有一个本地存储库,因此无法直接从中复制或导出项目git服务器到服务器。

I am facing a situation where,
I have two different git lab servers, consider "A" and "B". I pulled one project repository from server "A" to my local client. Now, i want to push this local repository to server "B". But during this migragtion, i want to keep all the previous commits and configs saved on new server too. (which means, i cannot create a fresh repository on server "B" from the local data)

Note : I lost access to git server "A", and just have a local repository on git client, so cannot copy or export project directly from git server to server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七婞 2025-02-13 02:12:18

您的所有历史记录都保存在您在本地的.git文件夹中。因此,您的所有提交已经保存。但是,您将失去 gitlab a 配置,因为这与git和gitlab的特定有关。如果您想保留所有内容,则必须在可能的情况下进行出口,否则您只能保留与git相关的内容。

您必须在 gitlab b 上创建一个空白项目,然后按照“推动现有的git存储库” 步骤:

cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab_B_url/GROUP/PROJECT.git
git push -u origin --all
git push -u origin --tags

All your history is kept in the .git folder that you have in local. So all your commits are already saved. But you will lose Gitlab A configuration since this is not related to git and Gitlab specific. If you want to keep everything, you have to make the export if possible or you can keep only commits and git related stuff.

You have to create a blank project on Gitlab B and follow the "Push an existing Git repository" steps :

cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab_B_url/GROUP/PROJECT.git
git push -u origin --all
git push -u origin --tags
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文