Len*_*eng 8 linux git linux-mint
我正在全新安装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.
Run Code Online (Sandbox Code Playgroud)
这很奇怪,因为我肯定有一个支持简单推送行为的版本.
输出git --version是git version 1.8.3.2.
内容~/.gitconfig:
[user]
name = My Name
email = MyEmail@website.com
[color]
ui = true
[push]
default = simple
Run Code Online (Sandbox Code Playgroud)
这是令人毛骨悚然的地方.
如果我改变行为matching(或nothing,tracking或者current,对于这个问题),然后尝试推,我得到完全相同的错误消息.怎么可能?是以某种方式缓存配置?我甚至尝试重启.我甚至尝试从系统中彻底清除GIT(并删除~/.gitconfig)然后重新安装它.
如果我[push]从.gitconfig文件中完全删除该部分(或者如果我完全删除该文件),那么尝试推送,然后我得到:
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.
Run Code Online (Sandbox Code Playgroud)
...所以它似乎都承认我没有选择推动行为,但后来也说我选择了不受支持的行为.这到底是怎么回事?
如果我~/.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
Run Code Online (Sandbox Code Playgroud)
好吧,我修好了,但方法绝对是巫术。
我尝试通过清除 GIT、删除配置文件、重新安装 GIT、然后创建本地裸存储库、克隆它、然后尝试从那里推送来隔离问题。差不多是这样的:
sudo apt-get purge git-core
rm -f ~/.gitconfig
sudo apt-get install git-core
cd /git
mkdir foo
cd foo
git init --bare
cd /var/www
git clone /git/foo
cd foo
touch blah.txt
git add -A
git config --global user.name "Name"
git config --global user.email "user@email.com"
git commit -m "Blah"
git push
Run Code Online (Sandbox Code Playgroud)
...完全相同的错误消息,没有变化。(仍然是一些严重的巫术。)
然后,我删除了一个没有本地源的存储库(它通过 SSH 连接到其源),并在删除它后重新克隆该存储库(使用新命令git clone ssh://...)。
我从克隆命令中收到错误:
remote: Malformed value for push.default: simple
remote: Must be one of nothing, matching, tracking or current.
Run Code Online (Sandbox Code Playgroud)
啊哈! 现在它说remote而不是error. 所以遥控器不支持这种行为。(但这并不能解释为什么错误仍然存在于具有本地起源的本地存储库上。)
因此,我然后通过 SSH 连接到远程服务器,并将那里的 git-core 更新到最新版本,重新尝试从本地计算机克隆存储库,结果成功了。
现在,我终于可以了git push。疯狂的是,这也修复了它,这样我就可以 git push从完全本地/var/www/foo到也完全本地 /git/foo(本地原始裸存储库)。通过 SSH 连接到此远程服务器并以某种方式更新它 - WITCHCRAFT - 修复了我本地计算机的错误。
为什么完全本地的存储库会关心完全不同的机器的 GIT 版本……这超出了我的理解。多么彻底、多么疯狂。
| 归档时间: |
|
| 查看次数: |
3782 次 |
| 最近记录: |