Day by Day, Site by Site

Open source, Some Code, Troubleshooting, Good Links

Миграция репозиториев Gitlab на другой сервер

   devops

Необходимо перенести репозитории Gitlab на другой сервер.

#!/bin/bash

# migrate repos to another gitlab.

# directory with code
DIRECTORY=~/Code
# name of repository
REPO_NEW=enserver
# name of old repository
REPO_OLD=${REPO_NEW}.git

cd $DIRECTORY

echo "Clone from old server"
git clone --mirror git@gitlab:apsh/$REPO_OLD

cd $REPO_OLD
# add new origin
git remote add newserver ssh://git@XX.XX.XX.XX:2001/apsh/$REPO_NEW

echo "Push in new server"

# push everything back to the new repo.
git push --mirror newserver