Just ran into this myself so thought I'd provide answer, I did the last option. You could either:
Use "Relative Path Support" in Portainer BE (you can sign-up to get free 3 node business edition license), see: https://docs.portainer.io/advanced/relative-paths
OR
Add a service container to do git checkout into volume, see: https://github.com/portainer/portainer/issues/6390#issuecomment-1100954657
OR
Use an environment variable to point to full path, see: https://github.com/portainer/portainer/issues/6390#issuecomment-1142664730
Ex (copy paste from above reference):
services: node: image: node:alpine volumes: - ${PROJECT_PATH:-$PWD}:/app
This will fail because /app folder will be empty. But you can go into the Container -> Container details -> Labels and check the com.docker.compose.project.working_dir Get this value and set the PROJECT_PATH env var to it. Also you might need to prepend it with the full path to portainer Ex. com.docker.compose.project.working_dir = /data/compose/5 Portainer absolute path is /mnt/ssd-pool/apps/portainer so the PROJECT_PATH is /mnt/ssd-pool/apps/portainer/data/compose/5 Then you can Pull and redeploy Also docker-compose has default value $PWD that is for local development.