GIT - move a full git repository from one remote sever to another one
Copied from
Let’s call the original repository ORI and the new one NEW, here are the steps required to copy everything from ORI to NEW:
Create a local repository in the temp-dir directory using:
git clone <url to ORI repo > temp-dir

Go into the temp-dir directory.
To see a list of the different branches in ORI do:
git branch -a

Checkout all the branches that you want to copy from ORI to NEW using:
git checkout branch- name

Now fetch all the tags from ORI using:
git fetch --tags

Before doing the next step make sure to check your local tags and branches using the following commands:
git tag
git branch -a

Now clear the link to the ORI repository with the following command:
git remote rm origin
Now link your local repository to your newly created NEW repository using the following command:
git remote add origin <url toNEW repo>
Now push all your branches and tags with these commands:
git push origin --all
git push --tags

You now have a full copy from your ORI repo.
Command line instructions from GITLAB
Git global setup
git config --global user.name "Lam Hung NGUYEN"
git config --global user.email "lamhung81@gmail.com"
Create a new repository
git clone
https://gitlab.com/lamhung81/auvfirmware.git
cd auvfirmware
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin
https://gitlab.com/lamhung81/auvfirmware.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin
https://gitlab.com/lamhung81/auvfirmware.git
git push -u origin --all
git push -u origin --tags
Last updated
Was this helpful?