I have my brand new Stash server installed, and now I am trying to migrate my Git repositories (which are currently hosted on some remote site). I already created a local copy using "git clone --mirror"(which includes all branches).
My question is:
What is the preferred way to import such a bare repository - including all branches and tags - to Stash?
My ideas so far:
- use a local script that pushes all branches and tags - one by one - to the Stash server
- got to the Stash "data/repositories" directory and execute a "git clone --mirror" there
One has to be very careful using
git clone --mirror
This command sets force update for all the references of remote origin:
[remote "origin"] url = ... fetch = +refs/*:refs/* mirror = true
As result one may accidentaly rewrite the whole history of mirrored repository just by running:
git fetch origin
That's why one should remove the remote right after the clone is completed:
git remote rm origin
So the whole sequence should be as follows:
git clone --mirror $ORIGINAL_URL git remote rm origin git remote add stash $STASH_URL git push --all stash git push --tags stash
Another important note: if you're importing Subversion repository into Stash with git-svn, I'd highly recommend you to use SVN Importer Plugin instead, here are the reasons:
Hope that helps.
You should be able to push all Branches and Tags to Stash by changing the origin (or adding Stash as another remote) and run "git push --all" and "git push --tags". Note that "all" includes all Branches, but not the Tags.
See the documentation for details: http://git-scm.com/docs/git-push
Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs