how do i use git namespaces locally?

Git namespaces is only intended to work with remote repos, not locally (https://github.com/git/git/commit/6b01ecfe22f0b6ccb9665cd8d85d78a381fecffc). Most of the operations that work using git namespaces appear to work on operations that go through the git-upload-pack and git-receive-pack functions. Thats why the documenation suggests if you want to test it locally to fake it into thinking you're pulling from a remote machine eg: git clone ext::'git --namespace=foo %s /tmp/prefixed.git'

so commands like

git --namespace foo add
git --namespace foo commit
git --namespace foo branch

All essentially do nothing. The only operations that appear to have any effect are clone/fetch/pull and push.

In order to leverage namespaces the way you're hoping, you'd have to set up your own git backend that is capable of translating URL arguments into the GIT_NAMESPACE variable and pass it along to git-http-backend or something similar. The documentation recommends the following in your apache configuration:

To serve multiple repositories from different gitnamespaces in a single repository:

SetEnvIf Request_URI "^/git/([^/]*)" GIT_NAMESPACE=$1
ScriptAliasMatch ^/git/[^/]*(.*) /usr/libexec/git-core/git-http-backend/storage.git$1

Also note that what this documentation does not say, is that what is going on here is extracting the GIT_NAMESPACE variable from a URL and setting an environment variable that git-http-backend is expecting. i.e. http://myserver.com/git/namespace/repository.git. The 'storage.git' part is a typo and should not be there. I should submit a documentation patch.

Here's most of the commits that created this feature. https://github.com/git/git/commits/398dd4bd039680ba98497fbedffa415a43583c16?author=joshtriplett