Copy a Git repository to another location

I was moving a git repository from gitlab to github enterprise. Here is what I used to move one repository. This ensures all the remote branches are correctly copied too.

git clone --mirror git-repo-url
git remote set-url origin new-git-repo-url
git push --mirror

Related references:
https://help.github.com/articles/duplicating-a-repository/
http://stackoverflow.com/questions/23295548/export-a-repository-from-a-gitlab-server-to-another-gitlab-server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s