Do you know if there is a way to block committing to a local git repository? In my build environment, I\'m running some git commands through it and it breaks if the user makes
You should clone the repository and do your work in the fork.
Forks on the local disk can use symlinks to save time and space.
Git does not have any notion of a lock.
That is not a Git-compatible work-flow. If you want an SCM with locking, use something else with a centralized-repository model. Some SCMs that support optional locks include SVN, CVS, and RCS.
Unless you are using a shared repository configured with core.sharedRepository enabled, you should be pushing to a bare repository and running any continuous integration or build systems off a non-bare clone. By definition, any shared repository can have the working directory modified by anyone with the necessary permissions, so you shouldn't be using a shared repository if you need to ensure a stable working directory during the lifetime of some process.
There are certainly some use cases for the shared repository model. However, yours is not one of them.
You could certainly design your own scripts to abuse the shared-repository model. For example, you might use semaphore files (such as those created by lockfile from the lockfile-progs package) or flock in a wrapper script that turns off write or execute permissions on your shared directory before kicking off some long-running build process. That's a lot of work for a very small pay-off, since you could get the same benefit with less work with a clone. However, it is technically feasible, so I mention it here for completeness.
Look into .git/hooks/pre-commit.sample. By manipulating this hook, you should be able to disable commit operation on remote or local git repository.