Using `cd` is not a good idea, it does not play nice with threads for instance.

I think you can also fix the problem by writing `git_command("--git-dir=#{@dir} #{@rpc} --stateless-rpc #{@dir}")`. Could you try that and update the PR if it works @datr ?