diff --git a/Move to a new git repo.md b/Move to a new git repo.md new file mode 100644 index 0000000..63e154c --- /dev/null +++ b/Move to a new git repo.md @@ -0,0 +1,34 @@ +# 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 +2. cd +3. git remote set-url origin +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.local/eloyd/Documentation + +``` +git clone --mirror https://git.bitnetix.com/Bitnetix/documentation +cd documentation.git +git remote set-url origin http://git.bitnetix.local/eloyd/Documentation.git +git push --mirror origin +rm -Rf documentation.git +git clone http://git.bitnetix.local/eloyd/Documentation +cd Documentation +```