Creates and manages a git repository in the operating system's temporary directory. Useful for running git operations in tests.