我已经从http://git-scm.com/download/mac下载并安装了git到我的Mac的/usr/local
目录下,但我不知道如何打开终端。
git --version
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装最新稳定版的Git。
brew install git
打开系统终端(Mac OS自带终端)
运行git --version
,您将看到版本信息!
ImageMagick
、tree
、GNU Parallel
、gnuplot
、doxygen
、fswatch
... - Mark Setchellhomebrew
版本将被安装在 /usr/local/bin
。Apple 提供的版本将在 /usr/bin
中。因此,如果您想使用 homebrew
版本,请使用 /usr/local/bin/git
。如果您想使用 Apple 提供的版本,请使用 /usr/bin/git
。如果您只想输入普通的 git
命令,请选择一个版本,并将其放在 PATH
的第一位。 - Mark Setchell我使用Windows,其中Git Bash是我用来执行git命令的应用程序。然而,在我的Mac上,Terminal应用程序用于执行类似于Windows上的Git Bash的Git命令。我有点困惑为什么在Git的网站上找不到适用于Mac的Git Bash版本。事实证明,所有的Git命令都在Mac终端应用程序Terminal中执行。如上所述,首先在终端中运行以下命令检查是否已正确安装Git:
git --version
如果终端输出了最新版本的git,则可以开始使用正常的git命令,就像在Git Bash中使用一样,例如:
git clone YOUR_REPOSITORY
或者
git checkout OTHER_BRANCH
我希望这能帮到你。
看起来你还没有执行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:
'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.
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
只会显示一个关于使用的错误信息,它并没有任何有用的功能。 - user149341
Ctrl-D
。 - Droppycmd+空格
并开始输入Terminal
,一旦猜测到您想要Terminal
,请按下Enter/Return
键。之后您可以在普通终端中输入git
命令,例如git status
。 - Mark Setchellgit
,位于/usr/bin/git
,因此如果您只输入git
,将会使用OSX提供的版本。而如果您输入/usr/local/bin/git
,则会使用您刚刚安装的版本。可以尝试使用git --version
和/usr/local/bin/git --version
来测试一下。 - Mark Setchell