gitea-push-dir 1.0.0
gitea-push-dir uploads a whole directory into a Gitea or Forgejo repository through the instance's contents API, with no git binary, no SSH key material and no working copy on disk. It is a single dependency-free Node script (Node 18+), driven entirely by environment variables: GITEA_HOST, GITEA_TOKEN, or GITEA_USER plus GITEA_PASSWORD. It walks the source directory recursively, skips .git, node_modules, .venv and __pycache__, then for every remaining file asks the API whether that path already exists on the target branch. Absent files are created with POST; existing ones are updated with PUT and the current blob sha -- omitting that sha is the single most common reason a hand-rolled uploader fails against Gitea. Binary files are handled correctly through base64 encoding. Each file becomes its own commit; one line per file is printed, followed by a summary, and the exit code is non-zero if any upload failed. The intended audience is anyone publishing generated output from a constrained environment: CI images and container jobs that ship without git, sandboxes with no key material, or one-shot tasks where provisioning SSH access costs more than the upload itself. The original use case was pushing a generated MkDocs source tree into a public repository so a documentation host could clone and build it. Deliberately limited in scope: it does not delete remote files that disappeared locally, does not create the repository, does not create missing branches, and does not batch commits. If you need any of that, use git.
| Tags | gitea forgejo ci devops nodejs upload |
|---|---|
| License | MITL |
| State | stable |