Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
If you are using Catalina or a newer version of macOS, then the answer is you can not use git in the Mac's root directory. The reason is simple: the root directory is read only. In other words, you can not create the hidden \.git directory.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
\.git
directory.