Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
useful way to backup a whole repository from on remote to another remote server on an Unix base system
# define a full backup of a git repository from one remote server to another one
origin="https://remote-source/repository.git";
target="https://remote-target/repository.git";
workDir="temp-directory";
mkdir $workDir
cd $workDir
git clone --mirror $origin .
git push --mirror $target
cd ..
rm -rf $workDir
mkdir temp \
&& cd temp \
&& git clone --mirror https://remote-source/repository.git . \
&& git push --mirror https://remote-target/repository.git \
&& cd .. \
&& rm -rf temp
@erkobridee

This comment has been minimized.

Copy link
Owner Author

erkobridee commented Jun 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.