有一个运行Gerrit的服务器,我没有ssh登录权限。 不过,我有一个具有管理员权限的Gerrit帐户。
如何创建新的Gerrit项目,然后将远程Git存储库导入其中? 我希望迁移所有信息,例如分支和标签。
以下是一些更多信息:
Gerrit服务器主机名: gerrit.example.com
旧Git repo URL: ssh://git@git.example.com/foobar
新Gerrit项目名称: foobar
具有管理员权限的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/*更多推荐
发布评论