"git init"失败了,怎么了?

hug*_*eow 14 git google-code git-config

此问题与" Bad git config file .git/config "不同,因为它在使用时失败git init.

似乎/home/mirror/.gitconfig没有任何问题:

[mirror@home php]$ git init
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/mirror/.gitconfig
Run Code Online (Sandbox Code Playgroud)

这是〜/ .gitignore的内容:

cat ~/.gitconfig
[alias]
        lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[user]
        email = xxxxxx@gmail.com
        name = xxxxx
[push]
        default = simple
Run Code Online (Sandbox Code Playgroud)

小智 21

在git v1.7.11中添加了Simple.如果您的git版本较旧,则此选项不存在.只需从您的conf中删除它,您就可以初始化回购.

请参阅https://raw.github.com/git/git/master/Documentation/RelNotes/1.7.11.txt


小智 6

现在git 1.8已经出现了这个问题.幸运的是,来自git的消息现在非常有用:

warning: push.default is unset; its implicit value is changing in
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)
Run Code Online (Sandbox Code Playgroud)

例如,对git(vc)的emacs接口不理解参数'simple',所以最好暂时使用参数'matching'.


mor*_*lan 5

尝试更新配置以使用matching而不是simplefor push.default.

git config --global push.default matching
Run Code Online (Sandbox Code Playgroud)

要么

git config push.default matching
Run Code Online (Sandbox Code Playgroud)