Hi there,
does anyone know if there is a possibility to migrate git repositories from an existing server in a batch?
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.
...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/*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.