git 致命:./config 中“core.sharedrepository”的错误配置值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6034632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:29:36  来源:igfitidea点击:

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

git

提问by max_

I just entered the command:git config core.sharedrepository 1and I am now receiving the error:

我刚刚输入了命令:git config core.sharedrepository 1现在我收到了错误:

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

致命:./config 中“core.sharedrepository”的错误配置值

Has anyone any idea how to fix it?

有谁知道如何解决它?

回答by MrOodles

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 config core.sharedRepository 输入无效值时,它可能会持续失败,而不是让您使用以下命令再次更新:

git core.sharedRepository group

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

在这种情况下,您需要打开 .git/config 文件并手动更改文件,如下所示:

[core]
    ...
    sharedRepository = group

回答by Andrew Marshall

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

问题正是它所说的:1是该设置的无效值。你可能想要true.

From the git-config manpage:

git-config 手册页:

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 worldor 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 0xxxis an octal number, files in the repository will have this mode value. 0xxxwill override user's umask value (whereas the other options will only override requested parts of the user's umask value). Examples: 0660will make the repo read/write-able for the owner and group, but inaccessible to others (equivalent to group unless umask is e.g. 0022). 0640is a repository that is group-readable but not group-writable. See git-init(1). False by default.

group(或true) 时,存储库可在组中的多个用户之间共享(确保所有文件和对象都是组可写的)。当all(or worldor everybody) 时,所有用户都可以读取存储库,此外还可以进行组共享。当 umask(或 false)时,git 将使用 umask(2) 报告的权限。当0xxx,其中0xxx是八进制数时,存储库中的文件将具有此模式值。0xxx将覆盖用户的 umask 值(而其他选项将仅覆盖用户 umask 值的请求部分)。示例:0660将使 repo 对所有者和组可读/可写,但其他人无法访问(等效于组,除非 umask 是 eg 0022)。0640是组可读但不可组写的存储库。参见 git-init(1)。默认为假。

回答by CharlesB

Try trueinstead of 1(see Git-config)

尝试true代替1(参见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.

core.sharedRepository

当 group (或 true)时,存储库可在组中的多个用户之间共享(确保所有文件和对象都是组可写的)。当全部(或世界或所有人)时,所有用户都可以读取存储库,此外还可以组共享。

回答by helmedeiros

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.8 开始,任何配置的布尔值都可以设置为yes/no、1/0、true/false 或 on/off。因此,在新版本中,相关问题不再发生,因为您可以在打印示例中查看,也可以在 git-config 手册中查看。

1.Checking the version:

1.检查版本:

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

2.Checking the actual branch configuration list:

2.查看实际分支配置列表:

? 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:

3.根据通知添加新配置:

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

4.Checking that this configuration was added:

4.检查是否添加了此配置:

? 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:

5.添加一个新的配置以显示没有错误:

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

6.Listing all values again:

6.再次列出所有值:

? 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:

7.将 core.sharedrepository 更改为其他有效的布尔值:

? 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

变量assign中等号后面的值都是字符串、整数或布尔值。布尔值可以给出为是/否、1/0、真/假或开/关。当使用 --bool 类型说明符将值转换为规范形式时,大小写在布尔值中不重要;git config 将确保输出为“true”或“false”。 http://git-scm.com/docs/git-config/1.8.1.5