git: minimize uploaded git files

Rather than uploading every checked-out file of a repository and the
repository objects themselves, skip the checkout and instruct git to compact
before upload. The result is that only a handful of files are transferred,
rather than hundreds or thousands for large repositories.

The HEAD ref is updated before upload so that a hard reset works as before on
the target. The reflog is also disabled in order to avoid uploading useless log
files.

This change is backwards-compatible, but it will only have an effect on new
repositories.