We migrated one of our repositories to git media, removing large binary files.

We assume the following:

* We are removing PDF and PNG here.
* New remote repos should be newly created.
* We use S3 for the storage.

Procedure

Create work branch for your safety.

% cd new-repos
% git checkout master
% git checkout -b work-filter-branch

Remove pdf and png from the working tree before enabling git-media.

% git filter-branch --index-filter \
'git rm -rf --ignore-unmatch **/*.{pdf,png}' \
-f --prune-empty HEAD

Enable filter on pdf and png in .gitattributes.

% $EDITOR .gitattributes
*.pdf filter=media -crlf
*.png filter=media -crlf
% git commit -m 'Configure .gitattributes for git-media' .gitattributes

Configure git-media.

% $EDITOR .git/config
% cat .git/config
...
[git-media]
        transport = s3
        s3user = johnd
        s3bucket = foo
        s3key = ...
        s3secret = ...
[filter "media"]
        clean = git-media filter-clean
        smudge = git-media filter-smudge

Copy pdf and png from the backup.

% for f in ../old-repos/subdir/**/*.{pdf,png}; \
cp $f new-repos/subdir`echo $f | sed 's/^.*subdir//'`

Commit pdf and png we've copied.

% git commit -m 'Restore .pdf and .png files' subdir/**/*.{pdf,png}

If everything seems okay, do the same on master. Then change remote to the new repos and push.

% $EDITOR .git/config
...
% git push origin master

Before uploading files, run git media sync.

% git media sync