Skip to content

Instantly share code, notes, and snippets.

@ocelotsloth
Created November 4, 2016 18:32
Show Gist options
  • Save ocelotsloth/a1fabfba6ddf2b4c6a5cebc87412d547 to your computer and use it in GitHub Desktop.
Save ocelotsloth/a1fabfba6ddf2b4c6a5cebc87412d547 to your computer and use it in GitHub Desktop.
Migrate git repo to lfs
#!/bin/bash
# Clone original repository
git clone git@git.gmu.edu:astavrou/isa564F16.git
# Convert repository with moving .zip, .pdf, .ppt, .pptx, .doc, .docx, .mov, .mp4 files to LFS
#
# Usage: <main class> [options] LFS file glob patterns
# Options:
# -c, --cache
# Source repository
# Default: .
# --check-lfs
# Check LFS server settings and exit
# Default: false
# * -d, --destination
# Destination repository
# -g, --git
# GIT repository url (ignored with --lfs parameter)
# -h, --help
# Show help
# Default: false
# -l, --lfs
# LFS server url (can be determinated by --git paramter)
# * -s, --source
# Source repository
# -u, --upload-threads
# HTTP upload thread count
# Default: 4
# -t, --write-threads
# IO thread count
# Default: 2
# --glob-file
# File containing glob patterns
java -jar git-lfs-migrate.jar \
-s isa564F16.git \
-d isa564F16-converted.git \
-g git@git.gmu.edu:astavrou/isa564F16-converted.git \
"*.zip" \
"*.pdf" \
"*.ppt" \
"*.pptx" \
"*.doc" \
"*.docx" \
"*.mov" \
"*.mp4"
# Push coverted repository to new repository
cd git-lfs-migrate-converted.git
git fsck && git push --mirror git@git.gmu.edu:astavrou/isa564F16-converted.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment