[英]migrate a remote Git repository to a new Gerrit project
有一個運行Gerrit的服務器,我沒有ssh登錄權限。 不過,我有一個具有管理員權限的Gerrit帳戶。
如何創建新的Gerrit項目,然后將遠程Git存儲庫導入其中? 我希望遷移所有信息,例如分支和標簽。
以下是一些更多信息:
Gerrit服務器主機名: gerrit.example.com
Old Git repo URL: ssh://git@git.example.com/foobar
新Gerrit項目名稱: foobar
具有管理員權限的Gerrit用戶帳戶: 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/*
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.