Migrating Git Repositories
Moving a Git repository from a server to another is a common situation that all developers could face with it, for example moving repositories from Bitbucket to Github or vice versa.
Doing this task is really terrible when you have to move a lot of repositories, you should manually
clone it and then
push it to the target server. Boring.
I wrote a shell script which help you out to move the repositories from any Git server to another, you can simply configure it and then just hit the Enter.
Ok, to get started you should clone or download this repository from Github: https://github.com/afshinm/git-migrate
After that, you should find two files,
CONFIG. We need
CONFIG file to configure our migration, it contains from and to servers.
CONFIG file is look like this:
repoName1:fromServer1:toServer1 repoName2:fromServer2:toServer2 repoName3:fromServer3:toServer3
Each repository should be in one line, and in each line we have three variables separated by : character. Repository name, from Git server and to server. You can choose anything for name part of the config, it’s not matter.
Here you can see an example of the
In above example I moved test repository from Bitbucket to Github. Please note that if in any variables you have : character, you should put a backslash before it to prevent the conflict between variables and values.
Also you can use both HTTPS and SSH urls for from or to servers but I prefer to use SSH forms (then you need to create a SSH Key and add it to both from and to servers, see this article)
After saving the
CONFIG file, everything is ready for migration. Just type below command in shell and press Enter:
Then you will see a log of migration in your shell environment. Also you will notice if there are any errors in migration.
Source: New feed