git gui not working after installing in Mac (e.g. Mountain Lion)

前端 未结 9 748
野趣味
野趣味 2021-01-30 02:07

When I ran git gui, I got this:

$ git gui
git: \'gui\' is not a git command. See \'git --help\'.

Did you mean one of these?
    grep
    init
    p         


        
相关标签:
9条回答
  • 2021-01-30 02:55

    2020

    brew install git
    brew install git-gui
    git config --global --add alias.gui '!sh -c '/usr/local/opt/git/libexec/git-core/git-gui''
    

    Now, enjoy:

    git gui
    
    0 讨论(0)
  • 2021-01-30 02:56

    While I am not sure how to open git gui from the terminal in Mountain Lion it is possible to use it using OpenInGitGUI which opens git gui from Finder. The download and instructions are available here.

    This may not be quite as convenient as typing 'git gui' in the terminal but it is pretty close. Basically all you need to do is type 'open .' to open the current directory in Finder and then click the Git button to open up git gui.

    0 讨论(0)
  • 2021-01-30 02:59

    This post: http://www.cmsimike.com/blog/2012/07/30/git-gui-and-osx-mountain-lion/ saves me.

    Edit ~/.bash_profile and put in

    alias gui='/usr/local/git/libexec/git-core/git-gui'
    

    Now the new command is gui instead of git gui.

    EDIT (28 Jan 2013)

    I have found a better answer to why git gui wasn't working: Did Apple remove the 'git gui' command in XCode 4.5 command line tools?. Please refer to this solution instead.

    Apple did indeed remove the 'git gui' command. I decided to just homebrew git instead of relying on the XCode command line tools.

    brew install git
    

    Then I edited the /etc/paths file to have the /usr/local/bin directory come before the /usr/bin directory, because that wasn't right either. Then exited the terminal window and restarted, and now I get:

    $ which git
    /usr/local/bin/git
    
    $ git --version
    git version 1.7.12.1
    

    and the git gui command works again.

    EDIT (2020-02-03)

    As of version 2.25.0_1, git gui is now provided by a separate formula in brew, named git-gui. See the following PR and issues for the background to this change: https://github.com/Homebrew/homebrew-core/pull/49136

    So along with installing Homebrew's git, to have access to git gui one must run

    brew install git-gui
    
    0 讨论(0)
提交回复
热议问题