
Let's say the following is being returned when attempting to use the git push command to push one or more files in the currently selected branch of the cloned repository on your PC to the origin Git repository.
error: insufficient permission for adding an object to repository database ./objects
If you have access to the origin Git repository, on the origin Git repository, use the chgrp (change group) command update all of the files and directories in the origin Git repository to be owned by a certain group (the "wheel" group in this example).
chgrp -R wheel /path/to/repository
Use the groups command to determine if your user account is a member of the group. If not, use the usermod command with the -aG (append groups) options to update your user account to be a member of the group.
~]# groups
john.doe wheel
Use the chmod (change mode) command to update all files and directories in the origin Git repository to be readable and writable by members of the group.
chmod -R g+rw /path/to/repository
Use the chmod and find command to update all directories in the origin Git repository to have the sgid permission so that when new files are added to the origin Git repository, they are owned by the group.
chmod g+s `find repodir -type d`
Did you find this article helpful?
If so, consider buying me a coffee over at