Some times you may need to move your git repository to another account, even between providers such as, github.com, butbucket.org, gitlab.com or even to your own git server.
- Write access to Both the repositories. Say my-old-repo and my-new-repo .
git clone --bare [email protected]:oldaccount/my-old-repo.git cd my-old-repo.git git push --mirror [email protected]:newaccount/my-new-repo.git cd .. rm -rf my-old-repo.git
Thats it, Now go to the new repository and you can see each commits, branches, tags etc.
Note: This procedure can be used to transfer repos between two services too. ie from bitbucket to github or vise-versa.
Comment if found helpful 🙂
Hashtags : #git #github #bitbucket