I had this problem a while back. I have decided as follows:
Open the folder of your local repository with the Finder. Click the folder and press ⌘I. This should open the folder information. If a padlock appears in the window, click and type the password of your Mac to give write permissions.
At the end of this window, search for "Sharing & Permissions". There is a permissions table and users. In your user, where it says "(Me)", select "Read and Write".
Click on the configuration icon (gear) and select "Apply to enclosed items".
This will put write and read permissions for all folders, subfolders, and files in your user to the folder of your local repository. If you're having difficulty, use this print as a reference.
If you happen to share this folder with someone on the network, it's a bit more boring to solve. Then you can try adding the following to your .gitconfig
:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sharedRepository = group
You have a more detailed blog about here .