1.1 KiB
1.1 KiB
How to migrate GIT repository from one server to a new one
Taken from: https://stackoverflow.com/questions/1484648/how-to-migrate-git-repository-from-one-server-to-a-new-one
Steps to take on new Git Repo
- Create a new repository
- Copy the link for step 3 below
Steps to take from a git-capable command line
- git clone --mirror <URL to my OLD repo location>
- cd <New directory where your OLD repo was cloned>
- git remote set-url origin <URL to my NEW repo location>
- git push --mirror origin
After
At this point, you have an old repo, a new repo, and a mirror on your filesystem. You can delete the .git folder and do a git clone of the new repo.
Examples
Old repo: https://git.bitnetix.com/Bitnetix/documentation New repo: http://git.bitnetix.com/eloyd/Documentation
git clone --mirror https://git.bitnetix.com/Bitnetix/documentation
cd documentation.git
git remote set-url origin http://git.bitnetix.com/eloyd/Documentation.git
git push --mirror origin
rm -Rf documentation.git
git clone http://git.bitnetix.com/eloyd/Documentation
cd Documentation