如何在 MAC 操作系统和 Linux 上安装 Git

在 Git 可供计算机使用之前,它不可用。 有几种方法可以安装和使用 Git。 您选择的选项取决于您运行的系统。

本文介绍如何在 MAC 操作系统上安装 Git,以及如何在 Linux 上安装 Git。

在与 Git 交互时,您需要注意一些事项。

  1. 我们建议您更新到最新版本,即使您已经安装了 Git。
  2. 以下所有命令都应适用于旧版本的 Git。 他们可能的行为有点不同,但应该行得通。 Git 非常适合保持向后兼容性。 2.0 及更高版本应该可以正常工作。

如何在 MAC 操作系统上安装 Git

有几种方法可以在 MAC 操作系统上安装 Git。 最简单的方法是安装 Xcode 命令行工具。 这适用于小牛(10.9)或更高,所以它应该涵盖你。 如果您在较旧的操作系统上运行,我们建议您首先考虑升级。

如果您的 MAC 操作系统运行良好,只需从终端首次运行 git 即可。 它看起来像这样:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ git – 版本 [/ht_message]

如果未安装,系统将提示您安装它。 如果已安装,则上述命令必须打印已安装的当前版本。

如果需要较新版本,或者需要,可以通过二进制安装程序在 MAC OS 上安装 Git。 有一个 MAC OS Git 安装程序,该安装程序在 GIT 网站上维护并可供下载。 https://git-scm.com/download/mac.

最后,在 MAC 操作系统上安装 Git 的第三个选项是作为 MAC 安装的一部分安装 GitHub。

他们有一个GUI Git工具,可以选择安装命令行工具以及。 您可以从 MAC 网站上下载此工具。 https://mac.github.com.

如何在 Linux 上安装 Git

在许多情况下,您可以使用发行版附带的包管理工具通过二进制安装程序在 Linux 上安装 Git。

如果您使用的是 Fedora 或其他密切相关的基于 RPM 的发行版(如 RHEL 或 CentOS),则可以使用 dnf:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ sudo dnf install git-all[/ht_message]

如果您使用的是基于 Debian 的发行版(如 Ubuntu),请尝试使用 apt:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ sudo apt install git-all[/ht_message]

安装在其他 Unix 发行版上

根图

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# emerge –ask –verbose dev-vcs/git[/ht_message]

Arch Linux

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]#パックマン-S git[/ht_message]

开放使用

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]#ザイッパーインストールgitの[/ht_message]

马盖亚

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]• 乌鲁普米 git[/ht_message]

尼克斯/尼克斯操作系统

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# nix-env -i git[/ht_message]

免费 BSD

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]• pkg 安装 git[/ht_message]

Solaris 9/10/11 (OpenCSW)

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkgutil -i git[/ht_message]

索拉里斯 11 快车

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]安装#pkgは開発者/版本控制/git[/ht_message]

开放BSD

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]# pkg_add git[/ht_message]

阿尔卑斯

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ APK 添加 git[/ht_message]

斯里塔兹

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]$ tazpkg get-install git[/ht_message]

给TA打赏
共{{data.count}}人
人已打赏
WordPress 教程

如何在 WordPress 中添加专业电子邮件模板

2022-9-20 4:33:16

WordPress 教程

Git:它是什么,它是如何工作的

2022-10-1 9:26:06

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
搜索