Thursday, December 15, 2011

Move Git repository from Unfuddle to BitBucket

mkdir temp
cd temp
git clone git@yourDomain.unfuddle.com:yourDomain/yourRepoName.git
cd yourRepoName/
git remote rm origin
git remote add origin https://yourUsername@bitbucket.org/yourUsername/yourNewRepoName.git
git remote show origin
git push origin master
cd ../..
rm -rf temp
git clone git@bitbucket.org:yourUsername/yourNewRepoName.git
view raw gistfile1.sh hosted with ❤ by GitHub

4 comments:

  1. This didn't push all my branches. How do I do that?

    ReplyDelete
    Replies
    1. After you clone your old repository you have to checkout all the branches:

      git branch -r # displays all remote branches
      git checkout -t origin/mybranch # checks out and tracks a given remote branch, do this for all of them

      ... continue as stated above ...

      git push origin mybranch # in the end push all the branches to the remote

      Delete