Files
Documentation/Move to a new git repo.md
2026-03-25 11:07:24 -04:00

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

  1. Create a new repository
  2. Copy the link for step 3 below

Steps to take from a git-capable command line

  1. git clone --mirror <URL to my OLD repo location>
  2. cd <New directory where your OLD repo was cloned>
  3. git remote set-url origin <URL to my NEW repo location>
  4. 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