9

I'm on a fresh install of Linux Mint.

I'm getting the following error when trying to push from any repository:

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.

This is very odd, because I definitely have a version that supports the simple push behavior.

The output of git --version is git version 1.8.3.2.

The contents of ~/.gitconfig:

[user]
    name = My Name
    email = MyEmail@website.com
[color]
    ui = true
[push]
    default = simple

Here's where it gets creepy.

If I change the behavior to matching (or to nothing, tracking, or current, for that matter), then attempt to push, I get the same exact error message. How is that possible? Is it caching the config somehow? I've even tried rebooting. I've even tried purging GIT completely from the system (and deleting ~/.gitconfig) then reinstalling it.

If I delete the [push] section completely from the .gitconfig file (or if I delete the file entirely), then try to push, then I get this:

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.

...so it appears to be both acknowledging that I haven't chosen a pushing behavior, but then also saying that I've chosen an unsupported behavior. What on earth is going on here?

I even get the error if I delete ~/.gitconfig completely.

Can anyone help me out with this witchcraft?

Thanks!

EDIT:

Here is a .git/config file requested:

[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
Leng
  • 2,948
  • 2
  • 21
  • 30
  • It already said: `(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)` – Raptor Jan 13 '14 at 04:11
  • 1
    @Shivan I don't need the 'current' mode. I don't use older versions of Git. Even if I set it to 'current', though, I get the same exact error. – Leng Jan 13 '14 at 04:12
  • But the error is because Malformed value for `push.default`. `Must be one of nothing, matching, tracking or current.` – Raptor Jan 13 '14 at 04:32
  • What is in the `.git/config` file of the repository on your computer where you are running these commands? – David Grayson Jan 13 '14 at 04:32
  • @DavidGrayson I've included an example config in my question. I get the error in every repo though, even brand spanking new ones that I just created and cloned (which is what this one I took the config file from is). Thanks for your time. – Leng Jan 13 '14 at 04:41
  • What is on line 8 in the config? I'm not sure the error and the fatal is related. – Andreas Wederbrand Jan 13 '14 at 04:50
  • @Andreas : That's the thing. There is no config file, even. I've totally deleted it and reinstalled Git. It's like it's permanently storing the error and regurgitating it. (`/home/leng/.gitconfig` does not exist.) – Leng Jan 13 '14 at 04:51

3 Answers3

4

Okay, so I fixed it, but the method is absolute witchcraft.

I tried to isolate the problem by purging GIT, deleting the config file, reinstalling GIT, then creating a local bare repository, then cloning it, then attempting to push from there. Pretty much like this:

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

...same exact error message, no change there. (Still some serious witchcraft.)

Then, I deleted one of my repositories that doesn't have a local origin (it connects to its origin via SSH) and cloned the repository anew after deleting it (with a fresh git clone ssh://... command).

I got an error from the clone command:

remote: Malformed value for push.default: simple
remote: Must be one of nothing, matching, tracking or current.

Ah ha! Now it says remote instead of error. So the remote doesn't support this behavior. (That doesn't explain why the error persists on local-only repositories with local origins, then, though.)

So I then SSH'ed into the remote server and updated the git-core there to the latest version, re-attempted to clone the repository from my local machine, and it worked.

Now, I can finally git push. Insanely, this also fixed it so I can git push from the entirely local /var/www/foo to the also entirely local /git/foo (the local origin bare repository). SSH'ing into this remote server and updating it somehow - WITCHCRAFT - fixed my local machine's error.

Why on earth the entirely local repos care about an entirely different machine's GIT version is... beyond me. How utterly, utterly insane.

Leng
  • 2,948
  • 2
  • 21
  • 30
  • Interesting, But what do you mean "one of my repositories that was connected to its origin via SSH and recloned it." What is the origin and what is "it"? – David Grayson Jan 13 '14 at 05:12
  • @David - One of my local repositories has a remote origin that it accesses through SSH. The origin is a bare repository you push and pull from. I deleted the entire local repository, then cloned "it" - the remote bare repository - (`git clone ssh://...`) again. – Leng Jan 13 '14 at 05:18
  • 1
    +1. Congratulations for solving the issue on your own! :-) A possible explanation is that you were using different versions of Git client and Git daemon that weren't compatible. It's quite odd, but it seems to me that your Git daemon did not support `push.default` at all ([introduced ~5 years ago](https://github.com/git/git/commit/521537476fe99b97bfcdf1b8f0c579061af5fd3e)). But as you said, that does not explain the bad behaviuor on local repositories. Frankly, I cannot find a better explanation right now. I'll comment again whenever something comes to mind or I learn something new about this. – jweyrich Jan 13 '14 at 05:25
  • @jweyrich Thank you! I was thinking something similar - but `sudo apt-get purge git-core` seems to remove even the daemon and other related packages, so I don't know how it would persist with the issue after a total purge and reinstall! I'll never forget this voodoo. I'm still creeped out. – Leng Jan 13 '14 at 05:31
3

I had the same error message on git push.

For me it turned out that the remote user's git was an older version (1.7.2.5), and I had recently updated the remote ~/.gitconfig to include:

[push]
  default = simple

The solution was to remove this setting from the remote's configuration.

Chris Merck
  • 454
  • 3
  • 12
2

Since it seems other people are having this issue, and I found a solution HERE, I thought I'd post the solution that worked for me.

IN SHORT: The solution I found was at this page. Evidently the best solution is to upgrade to a newer version of Git (if possible). That was not an option for me, however. From a local machine, I typed the following command:

git config -–global push.default upstream

This got rid of the Malformed value for push.default: simple error I had been getting. I'm not entirely sure what upstream does, however.

MY CONTEXT (for comparison): I had an empty (bare) repository on a remote computer, and I had a few repositories on a couple "local" workstations. I pull from the remote repository, do some work, and then push my work to the remote repository. Pushing/pulling was accomplished via SSH. Most of the time, while working on a local machine, pushing/pulling would result in the error described above.

In short, before the fix, I had the following ~/.gitconfig file on the remote machine:

[user]
        name = Foo Bar
        email = FooBarPerson@email.com
[diff]
        external = /Users/foobar/bin/git-diff-cmd.sh
[color]
        diff = auto
        status = auto
        branch = auto
[push]
        default = simple

After entering in the above command, my ~/.gitconfig file on the remote machine changed to:

[user]
        name = Foo Bar
        email = FooBarPerson@email.com
[diff]
        external = /Users/foobar/bin/git-diff-cmd.sh
[color]
        diff = auto
        status = auto
        branch = auto
[push]
        default = upstream

Version information:

  • Remote machine (repository location): 1.9.4
  • My laptop: 1.8.5.2 (Apple Git-48)
  • Other computer I work on: 1.7.7.4

Here's another site that may be useful to some people: http://www.lorrin.org/blog/2011/10/03/argumentless-git-pull-and-git-push/comment-page-1/

Dale Wilson
  • 9,166
  • 3
  • 34
  • 52
jvriesem
  • 1,859
  • 3
  • 18
  • 40