Reputation: 59
A step by step on how to move SVN repository to Bitbucket on linux.
I have some repositories in SVN that I would like to move to Bitbucket, if anyone know's how to do it via linux commands, I'd really appreciate it, so I can turn it into a script.
Thank you so much!
Upvotes: 4
Views: 9843
Reputation: 1
git svn clone --username <user_name> <SVN_Repo_url> --trunk=trunk --branches=branches --tags=tags
cd <Repo>/
#Provide branch names that are inside the Branchs dir
remote_branches=("branch1" "branch2" "branch3" "branch4")
for branch in "${remote_branches[@]}"; do
git remote add origin <Bitbucket_repo_url>
git checkout -b "$branch" "remotes/origin/$branch"
git push -u origin "$branch"
done
#Provide your own tags inside the Tags dir
tags=("develop.0.0.1" "develop.0.1.2" "feature.0.0.1" "feature.0.1.2" "QA.0.0.1" "QA.0.1.2")
for tag in "${tags[@]}"; do
git remote add origin <Bitbucket_repo_url>
git tag "$tag" "remotes/origin/tags/$tag"
git push -u origin "$tag"
done
trunks=("trunk")
for tag in "${trunks[@]}"; do
git remote add origin <Bitbucket_repo_url>
git tag "$trunks" "remotes/origin/$trunks"
git push -u origin "$trunks"
done
Upvotes: 0
Reputation: 38136
You can use git svn clone
command to migrate svn repo to git repo. Detail steps as below:
git svn clone <URL for svn repo>
# besides you can use --trunk, --branches and --tags etc for git svn clone command
# may be asked to enter SVN credentials
# after first creating the repo in bitbucket...
cd reponame
git remote add origin <bitbucket repo URL>
# you may also need to "git pull --allow-unrelated-histories" to merge you new local branch with the remote
# you may need to do a "git branch --set-upstream-to=origin/master"
# you may also need to another "git pull --allow-unrelated-histories" to merge you new local branch with the remote
git push origin --all
Upvotes: 7