How to migrate a hosted git repository to a new host?

I have a git repository hosted in TFS (e.g. https://tfsfoo.com/_git ) and I need to move it to another TFS host (e.g. https://tfsbar.com/_git )

My solution is to do the following (modified as suggested below using -mirror):

  • git clone https://tfsfoo.com/_git/proj --mirror
  • Scroll through the branches (git branch -r) and then git branch - open each of them (as in this post )
  • Note that I already clicked on a new repo (without branches), so -mirror was not an option.
  • git pull
  • git remote set-url origin https://tfsbar.com/_git/proj
  • git push -all -follow-tags

Now - I know that I can just try this to see if it works (and I will probably wait for an answer), but given that there are several ways to do almost everything in git, I wonder if there is a better way - or what even more important - if something is wrong with this approach (I'm relatively new to git).

+1
git tfs
Jun 07 '14 at 16:02
source share
2 answers

Since you have network access for the second server, then yes, clicking is the easiest way.

To create local branches for all branches of remote tracking, you can use a single-line box, which I usually use on git to pull all branches from a remote repository . "

An alternative is git clone --mirror first repo and push it to the second server as in this answer .

+3
Jun 07 '14 at 16:13
source share

You can achieve this with git-copy .

 git copy https://tfsfoo.com/_git https://tfsbar.com/_git 
0
Mar 26 '15 at 15:40
source share



All Articles