开发者

fatal: bad config value for 'core.sharedrepository' in ./config

I just entered the command:git config core.sharedr开发者_Go百科epository 1 and I am now receiving the error:

fatal: bad config value for 'core.sharedrepository' in ./config

Has anyone any idea how to fix it?


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


The problem is exactly what it's saying: 1 is an invalid value for that setting. You probably want true.

From the git-config man page:

When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable). When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable. When umask (or false), git will use permissions reported by umask(2). When 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. See git-init(1). False by default.


Try true instead of 1 (see Git-config)

core.sharedRepository

When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable). When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable.


As you can check, from 1.8 onwards the boolean values for any configuration can be set as yes/no, 1/0, true/false or on/off. So, in the new versions the related problem is not happening anymore as you can check forward, in print example, also in the git-config manual.

1.Checking the version:

➜ a git:(master) git --version
git version 1.8.1.5

2.Checking the actual branch configuration list:

➜ a git:(master) git config --list --local
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true

3.Adding a new configuration as informed:

➜ a git:(master) git config core.sharedrepository 1

4.Checking that this configuration was added:

➜ a git:(master) git config --list --local
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.sharedrepository=1

5.Adding a new configuration to show that there isn't errors:

➜ a git:(master) git config user.name abv 

6.Listing all values again:

➜ a git:(master) git config --list --local
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.sharedrepository=1
user.name=abv

7.Changing core.sharedrepository to other valid boolean value:

➜ a git:(master) ✗ git config core.sharedrepository on
➜ a git:(master) ✗ git config --list --local
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
core.sharedrepository=on
user.name=abv

The values following the equals sign in variable assign are all either a string, an integer, or a boolean. Boolean values may be given as yes/no, 1/0, true/false or on/off. Case is not significant in boolean values, when converting value to the canonical form using --bool type specifier; git config will ensure that the output is "true" or "false". http://git-scm.com/docs/git-config/1.8.1.5


To resolve this error go to your git project and find the folder .git inside this folder open with notepad or notepad++ config file.

Then you are going to see

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    sharedRepository = true

change the sharedRepository to true, then you are done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜