I gather there is (despite the lack of documentation) a way to set Git attributes globally; but I\'m not clear where to place the necessary gitattributes file.
There is some ambiguity in your question's terminology. In a Git context, "global" usually means "user-level"; in other words, a global setting affect all repositories for one specific user (the active one). In contrast, a system-wide setting affects all repositories for all users of a machine.
(I'm only mentioning this for completeness.)
According to the relevant section of the Pro Git book,
If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user’s workflow for that repository), then attributes should be placed in the
$GIT_DIR/info/attributesfile.
$GIT_DIR would typically expand to <path-to-repo-root-directory>/.git.
According to the relevant section of the Pro Git book,
Attributes that should affect all repositories for a single user should be placed in a file specified by the
core.attributesfileconfiguration option [...]. Its default value is$XDG_CONFIG_HOME/git/attributes. If$XDG_CONFIG_HOMEis either not set or empty,$HOME/.config/git/attributesis used instead.
You can also run the following command,
git config --global core.attributesfile <path>
to point Git to a custom path <path> for your global gitattributes file, e.g. ~/.gitattributes.
According to the relevant section of the Pro Git book,
Attributes for all users on a system should be placed in the
$(prefix)/etc/gitattributesfile.
which naturally begs the question:
[...] But where is
$(prefix)?
See What is $(prefix) on $(prefix)/etc/gitconfig? for an answer. Unless you've assigned prefix a custom, non-empty value, $(prefix) expands to nothing by default; therefore, your system-wide gitattributes file should reside in /etc/.