Question: 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?

Answer: 
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.
Since [`git update-index --add --cachinfo`](http://git-scm.com/docs/git-update-index) is important to add a file to the index, note that cacheinfo has a new syntax:

```
--cacheinfo <mode>,<object>,<path>
--cacheinfo <mode> <object> <path>

```

> 
> Directly insert the specified info into the index.  
> 
>  For backward compatibility, you can also give these three arguments as three separate parameters, but **new users are encouraged to use a single-parameter form**.
> 
> 
> 

See [commit ec160ae](https://github.com/git/git/commit/ec160ae12b0ae938ed5076b9f604e88976fc429c) by [Junio C Hamano (`gitster`)](https://github.com/gitster), March 2014, part of Git 2.0+:

> 
> `update-index`: teach `--cacheinfo` a new syntax "`mode,sha1,path`"
> 
> 
> The "`--cacheinfo`" option is unusual in that it takes three option parameters.  
> 
>  An option with an optional parameter is bad enough.  
> 
>  An option with multiple parameters is simply insane.
> 
> 
> Introduce a new syntax that takes these three things concatenated together with a comma, which makes the command line syntax more uniform across subcommands, while retaining the traditional syntax for backward compatiblity.
> 
> 
> 

---

Note: only git 2.0.X/2.1 (Q3 2014) takes care of the NULL case:  

See [commit c8e1ee4](https://github.com/git/git/commit/c8e1ee4f2c8e28b7eef824248f09ba37599593d7) by [Jeff King (`peff`)](https://github.com/peff):

> 
> Running "`git update-index --cacheinfo`" without any further arguments results in a segfault rather than an error message. [Commit ec160ae](https://github.com/git/git/commit/ec160ae12b0ae938ed5076b9f604e88976fc429c) (update-index: teach `--cacheinfo` a new syntax "`mode,sha1,path`", 2014-03-23) added code to examine the format of the argument, but forgot to handle the NULL case.
> 
> 
> Returning an error from the parser is enough, since we then treat it as an old-style "`--cacheinfo <mode> <sha1> <path>`", and complain that we have less than 3 arguments to read.
> 
> 
>