Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Git init failed

I tried to run git init in my terminal within a folder and I got this error message:

$ git init
error: Malformed value for push.default: origin
error: Must be one of nothing, matching, simple, upstream or current.
fatal: bad config variable ‘push.default’ in file ‘/Users/Me/.gitconfig' at line 9
$

Not sure what’s going on. Thanks!

2 Answers

The error is actually saying exactly what the problem is:

fatal: bad config variable ‘push.default’ in file '/Users/Me/.gitconfig' at line 9

It's the .gitconfig file in your home directory.

error: Malformed value for push.default: origin error: Must be one of nothing, matching, simple, upstream or current.

You have "origin" set for push.default and the only valid values are "nothing, matching, simple, upstream or current."

Nate Meyer

Do you mean Users/Me?

Also, which of the options for default are default? That sounds funny :D

64yes on Treehouse -- yep, /Users/Me/.gitconfig. Mine is set to simple which is probably the default since I haven't intentionally changed it.

Ok, that’s what I got from stackoverflow. :)

It's likely caused by having two different versions of Git installed. It's a known issue.

Often, this will fix the issue:

git config --global push.default matching

I think I just accidentally changed a setting, thank though