Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

MIgrating Git Repositories

Onur Onur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 9, 2012

Hi there,

does anyone know if there is a possibility to migrate git repositories from an existing server in a batch?

1 answer

0 votes
roy_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2012

current_url="ssh://git@somehost/"

new_url="http://user:pass@somehost/gitsomething/"

for repo in one.git two.git three.git

do

git clone --mirror ${current_url}${repo}

cd ${repo}

git push --mirror ${new_url}${repo}

cd -

rm -rf ${repo}

done

That will replicate the contents from one server to the other.

Aleksey Maksimov July 22, 2013

...except there is no --mirror in git pull. Here is the answer on how to get all changes from one repo:

http://stackoverflow.com/questions/2213689/opposite-of-git-push-mirror-how-do-i-get-my-repo-back

TL;DR:

instead of 'git pull --mirror' use

git fetch ${current_url}${repo} +refs/heads/*:refs/heads/*

roy_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2013

Thanks to your post I saw my mistype...

It was supposed to be clone instead of pull.

Here is my implementation (it makes a bare repo btw)
git clone --mirror $fromrepo ${BASEDIR}/${tmpname}

I then push it up into the other server
git push --mirror --force ${torepo}

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence administration certification, atlassian certified professional, confluence admin for cloud, atlassian learning, confluence training, confluence certification exam, confluence cloud admin, admin credential, atlassian certification

Become a certified Confluence admin today! 📖

Stand out as a skilled Confluence Cloud administrator. The Confluence Administration for Cloud certification proves you can configure permissions, manage site and space settings, and monitor activity—ensuring secure, effective collaboration for your team.

Start here
AUG Leaders

Atlassian Community Events