Progress:
TIER 3 · MODULE 54· Expert

git upload-archive

Streams a tarball back across the wire.

🎯 What & why

git upload-archive is the server-side counterpart of git archive --remote=.... It streams a tarball/zip of a tree back over the wire so clients can fetch a snapshot without cloning the whole repo.

🧠 Mental model

Same shape as upload-pack but for archives: client asks for a ref+format, server runs git archive and pipes the bytes back through the same transport (SSH or git://).

🛠️ Synopsis

git upload-archive <directory>

# Enable on git-daemon side
git config daemon.uploadarch true

# Client side that triggers it
git archive --remote=<url> --format=tar HEAD | tar x

🎚️ Switches & options

FlagWhat it does
<directory>The repository path the daemon/SSH wrapper passes in
(none else)This is a transport endpoint — flags come from the client's git archive invocation
daemon.uploadarch=trueRequired config on git daemon to allow this verb at all
uploadArchive.allowUnreachable=truePermits archiving commits not on any branch (off by default)

💡 Use cases

🧪 Examples

Enable on a daemon-hosted repo
git config daemon.uploadarch true
Client fetches a tarball over git://
git archive --remote=git://127.0.0.1/myrepo.git --format=tar v1.2.0 | tar x
Client over SSH (uses git-upload-archive transparently)
git archive --remote=git@127.0.0.1:myrepo.git --format=tar.gz HEAD > snap.tgz
Allow archiving an unreachable commit
git config uploadArchive.allowUnreachable true

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.