You need to:
- clone the Bitbucket repo
- create a local branch for all Bitbucket branches
- push everything to Stash.
That would means:
git clone -o bitbucket https://bitbucket.org/username/reponame
cd reponame
remote=bitbucket ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/[^\/]+\//,"",$1); print $1}'`; do git branch --set-upstream-to $brname $remote/$brname ; done
git remote add origin http://User@localhost:7990/scm/PROJECT/repo.git
git push --all
git push --tags
Couple of notes:
I have named the remote for the Bitbucket repo '
bitbucket
', instead of the default 'origin
'.
That is because you will end up working with your Stash repo by default.
That is why I reserved the remote name "origin
" for said Stash repo.Making a local branch for every bitbucket branches is described here: "Track all remote git branches as local branches".
I wouldn't recommend working in that local repo (which is tracking all Bitbucket branches).
I would rather cloned the newly filled Stash repo elsewhere, and work from there.