Environment
I was running ubuntu 18.04 in vagrant, and when I did git init and git add, git add.
displayed the following error:
VirtualBox:version 6.0.6r130049
error:insufficient permission for adding an object to repository database.git/objects
error:READ.md:failed to insert into database
error:enable to index file READ.md
fatal —Adding files failed
When I read the article online, it was a permission issue, so I looked up the permissions in ls-l.git/objects
.
drwxr-xr-x1 vagrant vagrant 96 Jun 2708:46 b6
drwxr-xr-x1 vagrant vagrant 160 Jun 2708:54 e4
drwxr-xr-x1 vagrant vagrant 96 Jun 2708:43ff
drwxr-xr-x1 vagrant vagrant64 Jun 2708:42 info
drwxr-xr-x1 vagrant vagrant 64 Jun 2708:42 pack
Output: ls-l.git
total12
-rw-rw-r -- 1vagrant vagrant 23 Jun 2708:42 HEAD
drwxr-xr-x1 vagrant vagrant 64 Jun 2708:42 branches
-rw-rw-r--1vagrant vagrant 111 Jun 2708:42 config
-rw-rw-r -- 1vagrant vagrant 73 Jun 2708:42 description
drwxr-xr-x1 vagrant vagrant 416 Jun 2708:42 hooks
drwxr-xr-x1 vagrant vagrant 96 Jun 2708:42 info
drwxr-xr-x1 vagrant vagrant 224 Jun 2708:49 objects
drwxr-xr-x1 vagrant vagrant 128 Jun 2708:42 refs
I think it's the same error as here, but I don't know why it works well with sudo.
https://github.com/hashicorp/vagrant/issues/10913
In fact, sudogit add.
worked.However, I don't want to add sudo every time, so it would be helpful if there is a solution.
Looking at this, the owner can read and write, so there seems to be no problem with the permission, but what is the cause?
I would appreciate it if you could let me know if anyone knows.
Thank you for your cooperation.
.git/
Because there are small subdirectories below the directory, it may be easier to change permissions in bulk than to identify individual files that cause them.
Change Owners and Groups
$chown-R vagrant.vagrant.git
add read-write permissions
$chmod-Rug+rw.git
Note:
can't add file to git repository but change/commit-Stack Overflow
© 2024 OneMinuteCode. All rights reserved.