15

This issue is not same as "Bad git config file .git/config", since it failed when using git init.

It seems there is nothing wrong with /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

This is the content of ~/.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
Community
  • 1
  • 1
hugemeow
  • 7,777
  • 13
  • 50
  • 63
  • 4
    Well, the error message seems quite explicit doesn't it? `simple` is not a valid value for `default`. It must be one of those suggested. – Yno Sep 06 '12 at 07:20
  • 1
    Actually, I'm using git 1.8.0 and when I first tried a `git push` with it I got the warning that `push.default` was not set, so I "Adopted the new behaviour" and did `git config --global push.default simple`. I now get this error trying to do a `pod install`. – Brett Ryan Dec 11 '12 at 06:21
  • 2
    Sorry, I found my problem, I had just installed the Xcode command line tools which has now overridden my Git version and reverted it back to `1.7.10.2`. – Brett Ryan Dec 11 '12 at 06:22
  • Note: starting Git 2.2 (Q4 2014), the error message will read `bad config file line 7` (not line 8). See [my answer below](http://stackoverflow.com/a/26473797/6309) – VonC Oct 20 '14 at 19:54

6 Answers6

22

Simple was added in git v1.7.11. If your git version is older, this option doesn't exist. Simply remove it from your conf and you'll be able to init repos.

See Documentation

Osama Rizwan
  • 615
  • 1
  • 7
  • 19
Kim E
  • 324
  • 2
  • 5
  • I ran into this because I'm using Ubuntu 13.10 on my desktop, but running a Vagrant VM using the default precise64.box (12.04), and apparently the newest git package for 12.04 is 1.7.9.5. – odigity Apr 01 '14 at 21:39
6

This problem keeps coming up now that git 1.8 is out. Luckily the message from git is now very helpful:

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)

For example, emacs interface to git (vc) does not understand the argument 'simple', so you are better off using the argument 'matching' for the time being.

Heikki
  • 186
  • 1
  • 3
5

Try updating config to use matching instead of simple for push.default.

git config --global push.default matching

or

git config push.default matching
MKB
  • 7,587
  • 9
  • 45
  • 71
morefromalan
  • 302
  • 3
  • 9
1

Note that it can be problematic identifying the issue, considering the problem is at:

  • line 7 (default = simple),
  • not line 8 (which here doesn't exist)

Solutions:

  • Changing the value at line 7 solves the issue (git config --global push.default matching)
  • removing the config can help too (git config --global --unset-all push.default)

But most importantly, starting git 2.2 (Q4 2014), the git config error line number will be accurate.
See commit b3b3f60, by Matthieu Moy (moy):

config.c: fix accuracy of line number in errors

If a callback returns a negative value to git_config*() family, they call die() while printing the line number and the file name.
Currently the printed line number is off by one, thus printing the wrong line number.

Make linenr point to the line we just parsed during the call to callback to get accurate line number in error messages.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

Use the similar mode current instead of simple if you use a version of Git older than 1.7.11.

git config --global push.default current
Pleymor
  • 2,611
  • 1
  • 32
  • 44
0

Since I came across this when searching for the Malformed value for push.default: simple error I got when pushing/pulling, I figured other people may as well.

Here's a related question that provides more information for the passer-by (see my answer at the end for more links, too): GIT: Can't Push (Strange Config Issue)

Note in particular that this error seems to be caused by having an older version of Git somewhere. The best solution is to update to the latest version of Git on all machines.

If this is not possible for you, simply run the following commands (as mentioned by @morefromalan):

git config --global push.default matching

or

git config --global push.default upstream

to get rid of the error. This changes the default behavior of push operations as described HERE. You may have to to this for pull as well as push, but it seems to be working for me just having changed the default push behavior to upstream.

Good luck!

Community
  • 1
  • 1
jvriesem
  • 1,859
  • 3
  • 18
  • 40