Transfer git repository from one provider to another

Organisations/People move their infrastructure (git repositories) from one provider to another.

Here’s a site to compare the tools, Each tools have their own merits and demerits, it’s the organisations/individuals who select the tools based on their requirements.

Let’s Started

It’s very simple, in order to transfer/move repositories. You have to do git clone and git push.

git clone

Create a bare clone of the repository.

git clone --bare git@meXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXrm.git

–bare

Make a bare Git repository. That is, instead of creating <directory> and placing the administrative files in <directory>/.git, make the <directory> itself the $GIT_DIR. This obviously implies the -nbecause there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.

git push

Mirror push to the new repository.

git push --mirror git@biXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXed.git

–mirror

Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote.<remote>.mirror is set.

Conclusion:

We have successfully transfer git repositories from one provider to another very easily.

Leave a Reply

Your email address will not be published. Required fields are marked *