In xonsh[0], that would be:

    cd $HOME/media
    git ls-remote ...
(Not sure about the equivalent of shlex.quote, but in the worst case, you can just use "from shlex import quote as q" or something).

So yes, there are good alternatives to bash - even Python based.

[0] https://xon.sh/