Git – How to transfer or move repository between accounts

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

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top