How to migrate a Git repository
Issue
When the ip of the server is changes, or we use a new server. We will have to migrate our git repositories.
Solution
There are two ways to migrate our git repositories.
1. Copy all files of the server over
All the information (orgin, trunk, etc.) about the repository are stored in a folder named '.git', where we are initializing the repository. So, we need to copy the contents to the new server with the scp
command. It's really that simple.
Finally change the git remote's URL on the client side.
2. With push command
We can also init a new repository on the new server.
And push the code on the client side.