Skip to content

Instantly share code, notes, and snippets.

@andrey-utkin
Last active January 24, 2016 17:53
Show Gist options
  • Save andrey-utkin/c7c6500bd83f4be4e634 to your computer and use it in GitHub Desktop.
Save andrey-utkin/c7c6500bd83f4be4e634 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
ORIGIN_URI='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
LOCATION="${1:-`pwd`/linux-stable-mirror.git}"
if ! [[ -e "$LOCATION" ]]
then
git clone --bare "$ORIGIN_URI" "$LOCATION"
cd "$LOCATION"
git remote add github 'git@github.com:linux-stable/linux-stable.git'
git remote add gitlab 'git@gitlab.com:linux-stable/linux-stable.git'
git remote add bitbucket 'git@bitbucket.org:linux-stable/linux-stable.git'
else
cd "$LOCATION"
fi
git fetch --prune origin "+*:*"
git fetch --prune --tags origin "+*:*"
for x in `git remote | grep -v origin`
do
git push --force --prune $x +:
git push --force --prune --tags $x +:
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment