I found a solution:
git clone -n ssh://example.com/home/me/repo.git
# Create foo/bar since the checkout -n didn't create it
mkdir -p foo/bar/
# Create the new file
git show "foo/bar/baz|quux" > "foo/bar/baz-quux"
git add "foo/bar/baz-quux"
# Remove the old file in the index
git rm --cached "foo/bar/baz|quux"
git commit -m "Moved file with invalid name."
Note this doesn't allow to easily move a directory with an invalid name -- you'd have to git show origninal-name > new-name
each file (although a small shell script could help if there were many files).