Cyril Rohr
Cyril Rohr.

Send an archive of a Git repository over SSH


For a silly reason I wanted to send an archive of a local git repository to a remote server in one command.

Here is how you would do it over SSH, using git archive to create a tarball of your repository:

$ git archive HEAD | ssh server.ltd "cat - >> /path/to/archive.tar"

For reference, here are the git-archive and cat man pages.