laullon / gitx

GitX (L) - A gitk clone for OS X
http://gitx.laullon.com/
Other
839 stars 76 forks source link

Fails to open a git repository with push.default set to simple #211

Closed LudovicRousseau closed 11 years ago

LudovicRousseau commented 11 years ago

I am using git 1.8.0 and I got the message:

$ git push 
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)

After using the proposed command: git config --global push.default simplegitx fails to open the repository.

I have to use git config --global push.default matchingto be able to use gitx again.

bfanger commented 11 years ago

The problem

The PBGitRepository.gitDirForURL method executes the git rev-parse --git-dir command which fails and shows the "[dir] does not appear to be a git repository." error.

But this isn't the error message from the git command, which in my case was:

error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line [nr] in /Users/[username]/.gitconfig

GitX uses the git command install by Xcode:

$ /usr/bin/git --version 
git version 1.7.10.2 (Apple Git-33)

Solution

Open the GitX preferences and select the newer git executable.

I you installed git with brew it's probably located at /usr/local/bin/git

Tip: The keyboard shortcut command+shift+G when browsing for the executable allow you to jump to an hidden path.

LudovicRousseau commented 11 years ago

Exact. Using git from brew (version 1.8.0) solves this problem. I close this bug report.

Thanks