I'm messing around with the Ruby Git gem... seeing how I can use it to manage/access a Gitosis server I'm running. Does anyone know if it is possible to add/commit files to a local bare repo, or will I need to set up a local 'normal' repo and use SSH to push it to the bare repo on the localhost?
You should be able to do this using low level plumbing commands:
$ generate_contents | git hash-object -t blob -w --stdin $ git update-index --cacheinfo 100644 sha1 path
100644
: means an ordinary file.But bare repositories are meant to be used only to push into or fetch from. Bare repository doesn't need to have index at all!
You need a working tree to add a file to the index and commit it.
While it might be possible to change directly the internal content of a bare git repo through plumbing commands, I would really recommend setting up a normal clone, modify it and push the resulting commit back to the bare repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With