-
-
Save flyingoctopus/1294096 to your computer and use it in GitHub Desktop.
Put this in your shell's respective dot profile and smoke it!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
archive_github_repo() | |
{ | |
if [ ! -d .git ]; then | |
echo "You must run this from within the root of your git repo." | |
exit 1 | |
fi | |
pwd=`pwd` | |
repo_url=`git config --local --get remote.origin.url` | |
repo_name=`echo $repo_url | awk -F / '{print $2}' | sed -e s/.git//` | |
echo "Going to archive ${repo_url} to [email protected]:repositories/archive-${repo_name}.git" | |
echo "Press Ctrl-C in the next three seconds if this is not what you want..." | |
sleep 3 | |
echo "Okay, here we go. Creating repo on git.coverallcrew.com..." | |
ssh homestar.coverallcrew.com create_repo "archive-${repo_name}.git" | |
echo "Mirroring Github repo (this could take a while)..." | |
cd /tmp | |
git clone --mirror $repo_url | |
cd $repo_name.git | |
git config --bool core.bare false | |
git remote add archive [email protected]:repositories/archive-${repo_name}.git | |
echo "Pushing to archive (this could take a while)..." | |
git push archive --all | |
cd /tmp | |
echo "Cleaning up..." | |
rm -rf /tmp/$repo_name.git | |
cd "$pwd" | |
echo "Repo archived. If you want it, here's how you 'git' it:" | |
echo "git clone [email protected]:repositories/archive-${repo_name}.git" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment