Skip to content

Instantly share code, notes, and snippets.

@andrader
Last active December 11, 2022 18:18
Show Gist options
  • Save andrader/08bedf4641c4b80bec6d901954317d25 to your computer and use it in GitHub Desktop.
Save andrader/08bedf4641c4b80bec6d901954317d25 to your computer and use it in GitHub Desktop.
# first argument is repository to duplicate, second is a new empty repository
# `duplicate_repo.sh ARG1 ARG2`
# or
# `curl GIST_RAWURL | bash -s ARG1 ARG2`
SOURC="$1" && \
DEST="$2" && \
echo $SOURC $destrepo && \
git clone --bare $SOURC tmprepo && \
cd tmprepo && \
git push --mirror $DEST && \
cd .. && \
rm -rf tmprepo && \
git clone $DEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment