尝试从任何存储库推送时,我收到以下错误:
- 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版本1.8.3.2.
〜/ .gitconfig的内容:
- [user]
- name = My Name
- email = MyEmail@website.com
- [color]
- ui = true
- [push]
- default = simple
这是令人毛骨悚然的地方.
如果我将行为更改为匹配(或任何,跟踪或当前,为此),然后尝试推送,我得到相同的确切错误消息.怎么可能?是以某种方式缓存配置?我甚至试过重启.我甚至尝试从系统中彻底清除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,tracking or current.
- fatal: bad config file line 8 in /home/leng/.gitconfig
- fatal: Could not read from remote repository.
…所以它似乎都承认我没有选择推动行为,但后来也说我选择了一种不受支持的行为.到底是怎么回事?
如果我完全删除〜/ .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
解决方法
我试图通过清除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
…相同的错误信息,没有变化. (还是一些严重的巫术.)
然后,我删除了一个没有本地源的存储库(它通过SSH连接到它的源)并在删除它后重新克隆了存储库(使用新的git clone ssh:// …命令).
我从克隆命令得到一个错误:
- remote: Malformed value for push.default: simple
- remote: Must be one of nothing,tracking or current.
啊哈!现在它说远程而不是错误.所以远程不支持这种行为. (但这并不能解释为什么错误会继续存在于仅具有本地原点的本地存储库中.)
然后我将SSH连接到远程服务器并将git-core更新到最新版本,重新尝试从我的本地计算机克隆存储库,它工作正常.
现在,我终于可以推动了.疯狂地,这也修复了它,所以我可以从完全本地/ var / www / foo推送到完全本地/ git / foo(本地原始裸存储库). SSH进入这个远程服务器并以某种方式更新它 – WITCHCRAFT – 修复了我本地机器的错误.
为什么到目前为止完全不同的机器的GIT版本完全是本地回购关注…超出我的范围.多么彻底,完全是疯了.