Set the GIT_DIR environment GIT_DIR .
In bash:
export GIT_DIR=~/b
or, in PowerShell:
Set-Item env:GIT_DIR $env:HOME\b
Alternatively, you can use the --git-dir command line --git-dir for all git commands:
git --gir-dir=~/b status
See this article about git environment variables
About placing the git repository directory on another server: well, if you installed the file system from this server and have the appropriate permissions, this should work fine. The git commands that work in your local directory are mainly about accessing the file system, so they work as long as it works.
(To clarify: above, I assume that ~/b is a git directory, if .git is a ~/b subdirectory, you should use ~/b/.git instead)
source share