References:
ITER git repository: https://git.iter.org/projects/IMEX/repos/gittest/browse
ACH gitlab repository: https://gitlab.eufus.psnc.pl/ach/gittest
- Create or select origin repository, in this case it was ITER git repository
Clone origin repository with --
mirror
flag:git clone --mirror ssh://git@git.iter.org/imex/gittest.git
Change directory to newly cloned mirror repository:
cd gittest.git
Push mirrored repository to new origin with
--mirror
flag:git push --mirror git@gitlab.eufus.psnc.pl:ach/gittest.git
Warning!
Don’t use
git push --mirror
in repositories that weren’t cloned by--mirror
as well. It’ll overwrite the remote repository with your local references (and your local branches).Clone newly pushed repository and change directory to it:
cd ..git clone git@gitlab.eufus.psnc.pl:ach/gittest.gitcd gittest
Check current remote repository:
git remote -v
It shall print:
Rename current default remote repository label to more relevant name:
git remote rename origin gitlab
And check the result:
git remote -v
It shall print:
Add second remote (ITER, original one):
git remote add iter ssh://git@git.iter.org/imex/gittest.git
And check results:
git remote -v
It shall print:
- To push or pull to different remote:
- PUSH:
Gitlab:
git push gitlab <optionally-branch-name}
ITER:
git push iter <optionally-branch-name>
Note
First push to newly added remote should be executed with {--set-upstream} flag, e.g.:
git push --set-upstream iter master
- PULL:
Gitlab:
git pull gitlab <optionally-branch-name>
ITER:
git pull iter <optionally-branch-name>
- PUSH: