git 如何在mac上打开git终端?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32974173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to open the git terminal on mac?
提问by Viki
I've installed git in /usr/local
on my mac from http://git-scm.com/download/macbut I'm confused about how to open the terminal.
我已经/usr/local
从http://git-scm.com/download/mac在我的 mac 上安装了 git,但我对如何打开终端感到困惑。
回答by Shannon Chou
I strongly recommend you use Homebrew to install git.
我强烈建议你使用 Homebrew 来安装 git。
- install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
install git last stable version.
brew install git
open system terminal (the Mac OS build-in terminal)
run
git --version
, You will see It!
- 安装 Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装 git 最后一个稳定版本。
brew install git
开放系统终端(Mac OS 内置终端)
运行
git --version
,你会看到它!
About Homebrew.
关于家酿。
回答by Yilmaz
Bash is shell. In mac you already got Bash but in windows you get Bash when you install git. So in mac you will use terminal for your git, but in windows you get separate git terminal. I think that's why you are confused.
Bash 是外壳。在 mac 中,您已经获得了 Bash,但在 Windows 中,当您安装 git 时,您将获得 Bash。因此,在 Mac 中,您将使用终端作为 git,但在 Windows 中,您将获得单独的 git 终端。我想这就是你感到困惑的原因。
when you type
当你打字时
git --version
if u see it is already installed so you are ready to use the git in your terminal
如果您看到它已经安装,那么您就可以在终端中使用 git
回答by Droppy
It sounds like you have not performed steps 2 and 3 from the README.txt
file:
听起来您还没有从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
.
第 2 步 - 删除存根
在更高版本的 OS X(优胜美地及更高版本)中,您可能会看到如下消息:
'The "git" command requires the command line developer tools. Would you like to install the tools now?"
这是因为 OS X 已经开始提供存根;为了保持美观和易于卸载,git 安装程序将所有资产放在
/usr/local/git
. 结果,/usr/local/git/bin/git 中的 git 排在 /usr/bin/git 之后。sudo mv /usr/bin/git /usr/bin/git-system
第 3 步 - 重新启动 bash 会话
这包括 GNU 屏幕会话、TMUX 会话等。如果您希望保留宝贵的屏幕会话,只需
source /etc/profile
.
回答by Hexana
On your command line, type "git" then cd to the directory where your project resides.
在您的命令行中,输入“git”,然后 cd 到您的项目所在的目录。