0

I have my project hosted at bitbucket. Now I am open sourcing it and want to move it to github. I have already created an empty github repository, but when I locally on my computer change the remote url to the new repo, it shows no changes and won't commit/push anything. I am clearly doing it wrong - what is the correct way of moving a project from one git repository/server to another one?

Andrey
  • 20,487
  • 26
  • 108
  • 176
  • Possible duplicate of [pull/push from multiple remote locations](https://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations) – phd Feb 25 '18 at 22:34

2 Answers2

2

I'm assuming that your Github repository is empty.

In your local folder, add a new remote repository:

git remote add github git@github.com:<username>/<repository>.git

Alternatively, if you did not set your ssh key on Github, you should use HTTPS:

git remote add github https://github.com/<username>/<repository>.git

Push your local master branch to the Github reposiroty:

git push github master
0

You will want to add the GitHub repo as a new remote to your existing local repo.

See this QA: Git: how to set remote in existing repo

You may need to do a Force Push if your new GitHub repo already has commits, and those commits will be lost.

Note that you could just set your existing BitBucket repo to public. GitHub does not have a monopoly on open-source projects.

Dai
  • 141,631
  • 28
  • 261
  • 374