将远程Git存储库迁移到新的Gerrit项目(migrate a remote Git repository to a new Gerrit project)

编程入门 行业动态 更新时间:2024-10-17 02:53:21
将远程Git存储库迁移到新的Gerrit项目(migrate a remote Git repository to a new Gerrit project)

有一个运行Gerrit的服务器,我没有ssh登录权限。 不过,我有一个具有管理员权限的Gerrit帐户。

如何创建新的Gerrit项目,然后将远程Git存储库导入其中? 我希望迁移所有信息,例如分支和标签。

以下是一些更多信息:

Gerrit服务器主机名: gerrit.example.com

旧Git repo URL: ssh://git@git.example.com/foobar

新Gerrit项目名称: foob​​ar

具有管理员权限的Gerrit用户帐户: erik

There is a server running Gerrit to which I have no ssh login permissions. I have, though, a Gerrit account with admin permissions.

How can I create a new Gerrit project and then import a remote Git repository into it? I would like all information to be migrated, e.g. branches and tags.

Here are some more information:

Gerrit server hostname : gerrit.example.com

Old Git repo URL : ssh://git@git.example.com/foobar

New Gerrit project name : foobar

Gerrit user account with admin permissions : erik

最满意答案

您可以在本地桌面上运行此shell脚本。 在脚本中设置Shell变量以符合您的情况。

#!/bin/sh # Replace these variable values according to your situation gerritproject=foobar gerritserver=gerrit.example.com gerritadmin=erik giturl=ssh://git@git.example.com/foobar set -e gitdir=`mktemp -d` ssh -p 29418 $gerritadmin@$gerritserver gerrit create-project --name $gerritproject cd $gitdir git clone --mirror $giturl tmpname cd tmpname git remote add gerritremote ssh://$gerritadmin@$gerritserver:29418/$gerritproject git push gerritremote refs/*:refs/*

You could run this shell script on your local desktop. Shell variables are set in the script to match your situation.

#!/bin/sh # Replace these variable values according to your situation gerritproject=foobar gerritserver=gerrit.example.com gerritadmin=erik giturl=ssh://git@git.example.com/foobar set -e gitdir=`mktemp -d` ssh -p 29418 $gerritadmin@$gerritserver gerrit create-project --name $gerritproject cd $gitdir git clone --mirror $giturl tmpname cd tmpname git remote add gerritremote ssh://$gerritadmin@$gerritserver:29418/$gerritproject git push gerritremote refs/*:refs/*

更多推荐

本文发布于:2023-08-04 11:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415246.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到新   项目   Gerrit   Git   project

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!