[Hosting] How to set up a git deployment workflow?

I’m trying to set up a deployment workflow where I can push a local repo to the WPMU DEV hosting site (not using GitHub actions or Bitbucket pipelines)

This is the basic workflow: https://daveceddia.com/deploy-git-repo-to-server/

My workflow:

# 1. SSH into the site
ssh my-user@mysite.wpmudev.host

# 2. Turn the public folder into a git repo
cd ~/site/public_html
git init
git checkout -f

# 3. Create a private folder with bare repo
git init --bare ~/site/deployment.git

# 4. Create a post-receive hook
cd ~/site/deployment.git/hooks
cp post-update.sample post-receive

# 5. Define the post-receive logic
nano post-receive

--- post-receive content (line numbers are not present in real file) ---

1: #!/bin/bash
2: TARGET="~/site/public_html/"
3: GIT_DIR="~/site/deployment.git"
4:
5: while read oldrev newrev ref; do
6: if [[ $ref = refs/heads/main]]; then
7:   git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f main
8:   fi
9: done

--- eof ---

# 6. In the git repo on my local machine:
git remote add prod my-user@my-site.wpmudev.host:~/site/deployment.git

git push --set-upstream prod main

Two problems:

1. The above “git push” correctly calls the post-receive hook, but the git checkout command in line 7 fails. Console output: “remote: fatal: not a git repository: ‘~/site/deployment.git'”
2. The ~/site/deploy.git folder is only available for my own user, other devs do not see that folder