Git can include a configuration file conditionally for repositories under a directory. That lets a directory tree select author metadata without repeating the setting manually in every repository.
A generic conditional include
[includeIf "gitdir:/work/example/"]
path = /work/example/.gitconfig
The included file supplies its own [user] fields. The source contained real names, email addresses, and workstation paths; those values are deliberately not republished. The directory and included-file path above are generic examples.
Keep the matching rule distinct from the value
The gitdir condition selects repositories by their Git-directory path. The included file’s path selects the configuration to read. Multiple conditions can cover separate trees. The earlier Windows example used the same idea with a D:/Projects/.../ path.
Check the effective identity in the intended repository before creating a commit. This article changes no Git configuration, author identity, or history.