【发布时间】:2011-05-17 17:20:04
【问题描述】:
我刚刚输入了命令:git config core.sharedrepository 1,我现在收到错误:
致命:./config 中“core.sharedrepository”的配置值错误
有人知道怎么解决吗?
【问题讨论】:
标签: git
我刚刚输入了命令:git config core.sharedrepository 1,我现在收到错误:
致命:./config 中“core.sharedrepository”的配置值错误
有人知道怎么解决吗?
【问题讨论】:
标签: git
当您为 git config core.sharedRepository 输入无效值时,它可能会持续失败,而不是让您使用此命令再次更新:
git core.sharedRepository group
在这种情况下,您需要打开 .git/config 文件并手动更改文件,如下所示:
[core]
...
sharedRepository = group
【讨论】:
问题正是它所说的:1 是该设置的无效值。你可能想要true。
来自git-config man 页面:
当
group(或true)时,存储库可在组中的多个用户之间共享(确保所有文件和对象都是组可写的)。当all(或world或everybody)时,所有用户都可以读取存储库,此外还可以组共享。当 umask(或 false)时,git 将使用 umask(2) 报告的权限。当0xxx(其中0xxx是八进制数)时,存储库中的文件将具有此模式值。0xxx将覆盖用户的 umask 值(而其他选项只会覆盖用户的 umask 值的请求部分)。示例:0660将使所有者和组可以读/写 repo,但其他人无法访问(相当于组,除非 umask 是例如0022)。0640是组可读但不可组写的存储库。请参阅 git-init(1)。默认为假。
【讨论】:
尝试使用true 而不是1(参见Git-config)
core.sharedRepository
当组(或真)时,存储库 可以在几个人之间共享 组中的用户(确保所有 文件和对象是组可写的)。 当所有(或世界或每个人), 所有人都可以读取存储库 用户,此外 群组共享。
【讨论】:
如您所见,从 1.8 开始,任何配置的布尔值都可以设置为 yes/no、1/0、true/false 或 on/off。因此,在新版本中,相关问题不再发生,您可以在打印示例中以及 git-config 手册中进行检查。
1.检查版本:
➜ a git:(master) git --version
git version 1.8.1.5
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.根据通知添加新配置:
➜ a git:(master) git config core.sharedrepository 1
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.添加新配置以显示没有错误:
➜ a git:(master) git config user.name abv
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.将 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
变量assign中等号后面的值都是 字符串、整数或布尔值。布尔值可以给出为 是/否、1/0、真/假或开/关。大小写在布尔值中不重要 值,当使用 --bool 类型将值转换为规范形式时 说明符; git config 将确保输出为“true”或 “错误的”。 http://git-scm.com/docs/git-config/1.8.1.5
【讨论】:
要解决此错误转到您的 git 项目并在此文件夹中找到文件夹 .git使用记事本或 notepad++config 文件打开。强>
那你就去看看
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
sharedRepository = true
将 sharedRepository 更改为 true,然后就完成了。
【讨论】: