Git – How to transfer or move repository between accounts

23. August 2013 SysAdmin 0

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.

Pre-Requirements

  • Write access to Both the repositories. Say my-old-repo and my-new-repo .

Steps

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


Leave a Reply

Your email address will not be published.