<div class="gmail_quote"><div dir="ltr"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> 2. git adds and commits have to take place in the right repo.<br></blockquote></div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div><div>This should be easily doable, assuming git>=1.8.2 (if memory serves). Something like this (completely untested):</div><div><br></div><div>    git -C "$(dirname \"$passfile\")" add "$passfile"</div><div><br></div><div>Since git already does the walking up to the nearest working directory ancestor.</div>