git pull error: insufficient permission for adding an object to repository database

I got error "insufficient permission for adding an object to repository database .git/objects" when using "git pull" command:
$ git pull
Password for 'https://xxx@xxx.org':
remote: Counting objects: 23, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 11), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database .git/objects

fatal: failed to write object
fatal: unpack-objects failed

And fix it by using the following ways:

1. use "sudo git pull"
2. use "ls -al" to check permission on file/folders, update permission "chown user:user file/folders" and run "git pull" again.


Comments