Moving a project from bitbucket to github

Question:

The project itself is on bitbucket. It needs to be moved to github. Keep commits, etc. no need.

It turns out that you just need to delete the .git folder simply and do git init again and link the project to another remote (from github), right? Or could there be some other pitfalls? What you need to check more precisely before that.

Answer:

Keep commits, etc. no need

saving the history will not only be easier (see below), but also more useful (for further development):

  1. change the url of the origin repository to the url of an empty (not containing a single commit, in other terminology – not "initialized" in any way) repository:

     $ git remote set-url origin git@github.com/…/…
  2. send the story there:

     $ git push --all

that's all.


compare with the number of actions for the case of deleting local storage with the entire history:

$ rm -rf .git
$ git init
$ git add .
$ git commit
$ git remote add origin git@github.com/…/…
$ git push --all
Scroll to Top