12

On performing :

$ git push -u origin --all

I got an error:

remote: error: insufficient permission for adding an object to repository database ./objects

I googled, and find out a solution by Richard Hansen.

I had to perform:

$ git config core.sharedRepository group

Rather, I executed it as:

$ git config core.sharedRepository dev

because i thought I have to enter name of group in the actual command(here "dev" is the name of the group which has a user, named "gituser").

Since then, whenever I am trying to execute any command in Git Bash, it is saying:

fatal: bad numeric config value 'dev' for 'core.sharedrepository' in .git/config: invalid unit

For this too, I found a solution at this link

which says:

When you enter an invalid value for git config core.sharedRepository, it may fail continuously rather than let you update again with this command:

git core.sharedRepository group

In which case you will need to open up the .git/config file and alter the file manually, like so:

[core]
    ...
    sharedRepository = group

I did this, but all in vain. Still any command in Git Bash gives the same error :

fatal: bad numeric config value 'dev' for 'core.sharedrepository' in .git/config: invalid unit

Can somebody please help me in solving this issue. Thanks in advance.

Community
  • 1
  • 1
Ashish Goyal
  • 1,284
  • 1
  • 13
  • 22
  • Strange, that once the value is wrong, you cannot change it anymore... What I also encountered: trying to `git config core.sharedRepository group` as root caused the same error message. For the command it was necessary to login as the owner of the config file. – robsch Oct 14 '20 at 14:46

1 Answers1

12

I thought I have to enter name of group in the actual command

No: dev is simply not a valid value for that setting.

Try 'group' only.

git config core.sharedRepository group

If you need to modify manually the config, make sure to look for the .git/config file in your local cloned repo (not on the server).

The correct values are:

core.sharedRepository

  • group (or true): the repository is made shareable between several users in a group (making sure all the files and objects are group-writable).
  • all (or world or everybody): the repository will be readable by all users, additionally to being group-shareable.
  • umask (or false): Git will use permissions reported by umask(2).
  • 0xxx: where 0xxx is an octal number, files in the repository will have this mode value. 0xxx will override user’s umask value (whereas the other options will only override requested parts of the user’s umask value).

Examples:

  • 0660 will make the repo read/write-able for the owner and group, but inaccessible to others (equivalent to group unless umask is e.g. 0022).
  • 0640 is a repository that is group-readable but not group-writable.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 4
    Yes Von, I am trying the command with 'group', but the output is always 'fatal: bad numeric config value.......'. Infact executing even 'git status' is giving the same fatal error. I dont know how to revert back '$ git config core.sharedRepository dev'. – Ashish Goyal Nov 01 '15 at 09:02
  • 2
    @AshishGoyal you should be able to modify the `.git/config` file manually. – VonC Nov 01 '15 at 09:03
  • I am trying: $ git config core.sharedRepository group – Ashish Goyal Nov 01 '15 at 09:03
  • @AshishGoyal can you try and modify the `.git/config` file manually? – VonC Nov 01 '15 at 09:04
  • I tried that too, went to .git/config, under [core], i included 'shareRepository = group'. After saving the changes, when I come back to GitBash, still the same fatal error issue persists. – Ashish Goyal Nov 01 '15 at 09:07
  • @AshishGoyal you should not have included `shareRepository`: that setting should already have been there. If it was not, that means you are modifying the wrong config file. Check also your global config file just in case: `~/.gitconfig`. – VonC Nov 01 '15 at 09:09
  • @AshishGoyal make sure to modify the right local config file, the one at the root folder of your current repo, in `.git` subfolder. – VonC Nov 01 '15 at 09:11
  • ~/.gitconfig contains only two things '[http]' and '[https]' with respective proxy addresses. The path where .gitconfig is present, same path includes .git directory, inside which there is a config file. I included 'sharedRepository = group' in it. Apart from this my directory 'project.git' (which I clone in my local machine), it also has a config file, it also did not have sharedRepository parameter inside it. I included in that and tested. But it too doesnt solve the problem. – Ashish Goyal Nov 01 '15 at 09:16
  • 1
    @AshishGoyal wrong path. Go to the root folder of your repo: there will be a `.git` in it, with a `config` file: modify that file. – VonC Nov 01 '15 at 09:17
  • 1
    @AshishGoyal If you have to add sharedRepository, you are in the wrong file. – VonC Nov 01 '15 at 09:17
  • 1
    Whoa! Thank you so much Von! Finally I found the correct config file. I was searching for the config file in the git server. Instead I found it in my local machine, inside the folder which contained code files. Now all git commands are working fine. Thanks a lot for your help. – Ashish Goyal Nov 01 '15 at 09:27
  • @AshishGoyal I have edited the answer to make clear where to look. – VonC Nov 01 '15 at 09:31