Create a git with can add and commit, but never checkout
07:10 22 Apr 2026

I have a local git to code & commit & push.
I have a remote bare git+gitolite on the server to push into and automatically deploy (dev branch into test website, specific tags into production website).

Now on the production website, there's an uploadedFiles/ subfolder containing user-uploaded files.

I'd like to use git to keep track of newly added files, as well as of removed ones, and to use as a backup of this folder if needed.
Basically:
- a repo kept outside of my site (git init --separate-git-dir ...),
- a tailor-made .gitignore
- and a cron job which just does git add . and git commit -m ... every night.
- this git being eventually mirrored on another server for the backup to be effectively secured.

I'd like to prevent an accidental checkout/reset or whatever to remove files from the uploadedFiles folder (for instance, newly added files not yet saved).
Is there a config option or any other way to forbid a git to modify its working-tree?
A kind of "readonly working-tree" feature?
Something which allowes tree-->repo but disallows repo-->tree activity?

git