【发布时间】:2014-01-13 04:09:57
【问题描述】:
我正在全新安装 Linux Mint。
尝试从任何存储库推送时出现以下错误:
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
这很奇怪,因为我肯定有一个支持简单推送行为的版本。
git --version 的输出是git version 1.8.3.2。
~/.gitconfig的内容:
[user]
name = My Name
email = MyEmail@website.com
[color]
ui = true
[push]
default = simple
这就是令人毛骨悚然的地方。
如果我将行为更改为matching(或nothing、tracking 或current,就此而言),然后尝试推送,我会收到完全相同的错误消息。这怎么可能?它是否以某种方式缓存配置?我什至尝试过重新启动。我什至尝试从系统中完全清除 GIT(并删除 ~/.gitconfig)然后重新安装它。
如果我从 .gitconfig 文件中完全删除 [push] 部分(或者如果我完全删除该文件),然后尝试推送,然后我得到这个:
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
...所以它似乎是 both 承认我没有选择推动行为,但也说我选择了不受支持的行为。这到底是怎么回事?
如果我完全删除~/.gitconfig,我什至会收到错误消息。
谁能帮我解决这个巫术?
谢谢!
编辑:
这是一个.git/config 请求的文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://{my remote repo}
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
【问题讨论】:
-
已经说:
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) -
@Shivan 我不需要“当前”模式。我不使用旧版本的 Git。但是,即使我将其设置为“当前”,我也会得到同样的错误。
-
但错误是因为
push.default的值格式错误。Must be one of nothing, matching, tracking or current. -
运行这些命令的计算机上存储库的
.git/config文件中有什么内容? -
@DavidGrayson 我在我的问题中包含了一个示例配置。不过,我在每个 repo 中都遇到了错误,甚至是我刚刚创建和克隆的全新的 repo(这就是我从中获取配置文件的那个)。感谢您的宝贵时间。
标签: linux git linux-mint