On my server, I host some bare git repositories that I'm working on. I'd like to display some basic statistics about each repository on my website; for now, let's just say I want to do simple stuff like listing all the files in the repository. On a non-bare git repository, this can be done with
git ls-files
but for bare repositories this (and most other git commands) don't work. I'm sure there's probably a simple way of doing this particular command, but I'll probably want to show some complicated/project-specific stats for different repositories, so I'm really asking if there's a way to execute any/all git commands on a bare repository without have to make a temporary clone or something convoluted like that. I suspect there's some command parameter I need to set, but I haven't been able to figure out which one yet.
You can run this one:
Obviously you have to specify a branch or reference, because there is no working tree or index in a bare repository.
I don't know for other commands but you can actually do most of them in a bare repository, but those that require a working tree.