安装 Github for Mac 后从命令行使用 git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11872760/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:18:34  来源:igfitidea点击:

Using git from the command line after installing Github for Mac

macosgitgithubgithub-for-mac

提问by Nyxynyx

I installed Github for Mac, which works fine, but I can't run git commands from Terminal. Do I have another git that needs to be installed? Or do I have to enable some optio within Github for Mac?

我为 Mac 安装了 Github,它工作正常,但我无法从终端运行 git 命令。我还有另一个需要安装的 git 吗?还是我必须在 Github for Mac 中启用某些选项?

回答by VonC

Starting May 2013 ("Installing Git from GitHub for Mac"), you don't have to install another git distribution: everything is included.

从 2013 年 5 月开始(“从 GitHub for Mac 安装 Git”),您不必安装另一个 git 发行版:一切都已包含在内。

you can now easily install Git for use on the command line, without needing to download any separate packages.
And whenever we update the version of Git included with GitHub for Mac, you'll get the changes automatically – no work required on your part!

you may notice some changes to the Preferences window.
On the newly renamed "Advanced" tab, simply click "Install Command Line Tools".

You'll be prompted for an administrator password so that Git can be installed into /usr/local/bin, and then you should very shortly see that it succeeded:

您现在可以轻松安装 Git 以在命令行上使用,而无需下载任何单独的软件包。
每当我们更新 Mac 版 GitHub 随附的 Git 版本时,您都会自动获得更改——您无需做任何工作!

您可能会注意到首选项窗口发生了一些变化。
在新重命名的“ Advanced”选项卡上,只需单击“ Install Command Line Tools”。

系统会提示您输入管理员密码,以便将 Git 安装到 中/usr/local/bin,然后您应该很快就会看到它成功了:

enter image description here

在此处输入图片说明

回答by Adam Parkin

Git can be installed in a number of ways on OSX:

在 OSX 上可以通过多种方式安装 Git:

1) If you have MacPortsinstalled, you can install it through that by opening up a terminal and doing:

1)如果您安装了MacPorts,您可以通过打开终端并执行以下操作来安装它:

sudo port install git

2) Download it from the official site & mount & install the .dmg: http://git-scm.com/download/mac

2)从官方网站下载并挂载和安装.dmg:http: //git-scm.com/download/mac

回答by JDwyer

https://help.github.com/articles/set-up-git#platform-machas instructions on setting up git for the command line. (essentially download http://git-scm.com/download/macand setup the config)

https://help.github.com/articles/set-up-git#platform-mac有关于为命令行设置 git 的说明。(基本上下载http://git-scm.com/download/mac并设置配置)

Note for windows users you can use a workaround program called "Git Bash" to approximate a unix like command line from which you can execute git commands.

请注意,对于 Windows 用户,您可以使用名为“Git Bash”的变通程序来模拟类似 Unix 的命令行,您可以从中执行 git 命令。