A solution to this is apptainer: you configure it to not see any of the host files by default, and mount the repo you want to work on at runtime.