关于macos:如何在Mac上打开git终端?

How to open the git terminal on mac?

我已经从http://git-scm.com/download/mac在Mac上的/usr/local中安装了git,但是对于如何打开终端感到困惑。


我强烈建议您使用Homebrew安装git。

  • 安装自制软件
    ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装git最后一个稳定版本。
    brew install git

  • 开放系统终端(Mac OS内置终端)

  • 运行git --version,您将看到它!

  • 关于自制。


    重击是壳。 在Mac中,您已经安装了Bash,但在Windows中,安装git时就安装了Bash。 因此,在Mac中,您将使用git终端,但在Windows中,您将获得单独的git终端。 我认为这就是为什么你感到困惑。

    当您键入

    1
    git --version

    如果您看到它已经安装,那么您就可以在终端中使用git了


    听起来您尚未从README.txt文件执行步骤2和3:

    Step 2 - Remove stubs

    In later versions of OS X (Yosemite and onward), you'll probably see a message like the following:

    1
    2
    'The"git" command requires the command line developer
    tools. Would you like to install the tools now?"

    This is because OS X has started to ship with stubs; in order to stay
    nice and easy-to-uninstall, the git installer places all of it's
    assets under /usr/local/git. As a result, the git in
    /usr/local/git/bin/git takes second place to /usr/bin/git.

    1
    sudo mv /usr/bin/git /usr/bin/git-system

    Step 3 - Restart bash sessions

    This include GNU screen sessions, TMUX sessions, etc. If you wish to preserve your precious screen session,
    just source /etc/profile.


    在命令行上,键入" git",然后输入cd到项目所在的目录。