gitgrit

Is it possible to add/commit a file to the index of a local bare Git repo?


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?


Solution

  • 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
    

    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!