Installing Git (安装 Git)

Installing Git [安装 Git]

  • 1. Installing Git
    • 1.1. Description
    • 1.2. Installing on Linux (在 Linux 上安装)
    • 1.3. Installing on macOS (在 macOS 上安装)
    • 1.4. Installing on Windows (在 Windows 上安装)
    • 1.5. Installing from Source (从源代码安装)
  • 2. `sudo apt-get install git`
  • 3. `git version`
  • References

Pro Git (SECOND EDITION)
https://git-scm.com/book/en/v2

Pro Git (SECOND EDITION)
https://git-scm.com/book/zh/v2

1. Installing Git

1.1. Description

检查系统中是否安装了 git

strong@foreverstrong:~$ git
usage: git [--version] [--help] [-C <path>] [-c name=value][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>]These are common Git commands used in various situations:start a working area (see also: git help tutorial)clone      Clone a repository into a new directoryinit       Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add        Add file contents to the indexmv         Move or rename a file, a directory, or a symlinkreset      Reset current HEAD to the specified staterm         Remove files from the working tree and from the indexexamine the history and state (see also: git help revisions)bisect     Use binary search to find the commit that introduced a buggrep       Print lines matching a patternlog        Show commit logsshow       Show various types of objectsstatus     Show the working tree statusgrow, mark and tweak your common historybranch     List, create, or delete branchescheckout   Switch branches or restore working tree filescommit     Record changes to the repositorydiff       Show changes between commits, commit and working tree, etcmerge      Join two or more development histories togetherrebase     Forward-port local commits to the updated upstream headtag        Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch      Download objects and refs from another repositorypull       Fetch from and integrate with another repository or a local branchpush       Update remote refs along with associated objects'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

1.2. Installing on Linux (在 Linux 上安装)

If you want to install the basic Git tools on Linux via a binary installer, you can generally do so through the package management tool that comes with your distribution. If you’re on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use dnf:

$ sudo dnf install git-all

If you’re on a Debian-based distribution, such as Ubuntu, try apt:

$ sudo apt install git-all

For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux.

1.3. Installing on macOS (在 macOS 上安装)

There are several ways to install Git on macOS. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run git from the Terminal the very first time.
在 Mac 上安装 Git 有多种方式。最简单的方法是安装 Xcode Command Line Tools。

$ git --version

If you don’t have it installed already, it will prompt you to install it.
如果没有安装过命令行开发者工具,将会提示你安装。

If you want a more up to date version, you can also install it via a binary installer. A macOS Git installer is maintained and available for download at the Git website, at https://git-scm.com/download/mac.
如果你想安装更新的版本,可以使用二进制安装程序。 官方维护的 macOS Git 安装程序可以在 Git 官方网站下载,网址为 https://git-scm.com/download/mac。

1.4. Installing on Windows (在 Windows 上安装)

The most official build is available for download on the Git website. Just go to https://git-scm.com/download/win and the download will start automatically. Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org.
官方版本可以在 Git 官方网站下载。

1.5. Installing from Source (从源代码安装)

If you do want to install Git from source, you need to have the following libraries that Git depends on: autotools, curl, zlib, openssl, expat, and libiconv. For example, if you’re on a system that has dnf (such as Fedora) or apt-get (such as a Debian-based system), you can use one of these commands to install the minimal dependencies for compiling and installing the Git binaries:

$ sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel \openssl-devel perl-devel zlib-devel
$ sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev \gettext libz-dev libssl-dev

In order to be able to add the documentation in various formats (doc, html, info), these additional dependencies are required:

$ sudo dnf install asciidoc xmlto docbook2X
$ sudo apt-get install asciidoc xmlto docbook2x

If you’re using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the install-info package:

$ sudo apt-get install install-info

If you’re using a RPM-based distribution (Fedora/RHEL/RHEL-derivatives), you also need the getopt package (which is already installed on a Debian-based distro):

$ sudo dnf install getopt

Additionally, if you’re using Fedora/RHEL/RHEL-derivatives, you need to do this:

$ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

due to binary name differences.

When you have all the necessary dependencies, you can go ahead and grab the latest tagged release tarball from several places. You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git, or the mirror on the GitHub website, at https://github.com/git/git/tags. It’s generally a little clearer what the latest version is on the GitHub page, but the kernel.org page also has release signatures if you want to verify your download.
通常在 GitHub 上的是最新版本,但 kernel.org 上包含有文件下载签名,如果你想验证下载正确性的话会用到。

Then, compile and install:

$ tar -zxf git-2.8.0.tar.gz
$ cd git-2.8.0
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info

After this is done, you can also get Git via Git itself for updates:

$ git clone https://git.kernel.org/pub/scm/git/git.git

2. sudo apt-get install git

strong@ubuntu:~$ git clone https://github.com/pjreddie/darknet.git
The program 'git' is currently not installed. You can install it by typing:
sudo apt-get install git
strong@ubuntu:~$ sudo apt-get install git

3. git version

strong@foreverstrong:~$ git --version
git version 2.7.4

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/721088.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python常用验证码标注和识别(需求分析和实现思路)

目录 一、需求分析 图像验证码识别&#xff1a; 文本验证码识别&#xff1a; 二、实现思路 三、案例与代码 四、总结与展望 在当今的数字时代&#xff0c;验证码&#xff08;CAPTCHA&#xff09;作为一种安全机制&#xff0c;广泛应用于网站和应用程序中&#xff0c;以防…

Method Not Allowed (GET): /user/logout/

在使用 DJango 框架使用框架默认的【登出】视图时&#xff0c;发现报错如下&#xff1a; Method Not Allowed (GET): /user/logout/ Method Not Allowed: /user/logout/ 退出部分的代码原先如下&#xff08;登出部分见第6行&#xff09;&#xff1a; <p><a href"…

PySide6实现socket通信程序

目录 一:实现思路 二:实现代码 三:完整代码和界面 一:实现思路 在PySide6中,服务端可以使用QTcpServer类来实现一个Socket服务器端,这个类可以便捷地创建TCP服务器。在客户端可以使用QTcpSocket实现Socket通信,并使用QTextEdit来显示消息。

MySQL 8.0.35 企业版安装和启用TDE插件keyring_encrypted_file

本文主要记录MySQL企业版TDE插件keyring_encrypted_file的安装和使用。 TDE说明 TDE( Transparent Data Encryption,透明数据加密) 指的是无需修改应用就可以实现数据的加解密&#xff0c;在数据写磁盘的时候加密&#xff0c;读的时候自动解密。加密后其他人即使能够访问数据库…

Unity 摄像机的深度切换与摄像机画面投影

摄像机可选&#xff1a;透视、正交 正交类似投影&#xff0c;1比1 透视类似人眼&#xff0c;近大远小 摄像机投影 在项目中新建&#xff1a;渲染器纹理 将新建纹理拖动到相机的目标纹理中 新建一个平面&#xff0c;将新建材质组件放到平面中即可。 相机深度切换 使用代…

93. 通用防重幂等设计

文章目录 一、防重与幂等的区别二、幂等性的应用场景三、幂等性与防重关系四、处理流程 一、防重与幂等的区别 防重与幂等是在 Web 应用程序和分布式系统中重要而又非常常见的问题。 防重 防重是指在多次提交同样的请求过程中&#xff0c;系统会检测和消除重复的数据&#xf…

每天一个数据分析题(一百八十三)

以下哪一项不是逻辑回归模型的特点&#xff1f; A. 因变量通常为二分类型变量 B. 自变量可以是分类型或连续型变量 C. 适用于处理连续自变量与二分类型因变量之间的关系 D. 通过logit转换&#xff0c;输出结果为实数域内的数值 题目来源于CDA模拟题库 点击此处获取答案

【动态规划】45. 跳跃游戏 II

45. 跳跃游戏 II 解题思路 int[] memo;&#xff1a;定义一个数组memo&#xff0c;用来作为备忘录&#xff0c;存储从每个索引位置跳到数组末尾所需的最小跳跃次数。 Arrays.fill(memo, n);&#xff1a;在开始计算之前&#xff0c;先将memo数组的所有元素初始化为n。这里的n是…

C语言中的宏函数与宏定义

C语言中的宏函数与宏定义 从开始写C语言到生成执行程序的流程大致如下&#xff1a; 预处理工作是系统引用预处理程序对源程序中的预处理部分做处理&#xff0c;而预处理部分是指以“#”开头的、放在函数之外的、一般放在源文件的前面的预处理命令&#xff0c;如&#xff1a;包…

流密码之线性反馈移位寄存器,以习题:n=4的LFSR,输出序列满足ki-4+ki-3+ki=0,初始状态为1000,求最终输出序列 为例

文章重点 关于线性反馈移位寄存器的一些知识点本期就不详细介绍了,本期重点在于讲解习题,以使大家能顺利应对平时作业及期末考试。 习题 习题1如下:n=4的LFSR。输出序列满足ki-4+ki-3+ki=0。 初始状态为1000。求不同时刻的状态及最终输出序列。 分析思路 思路:我们知道…

HTTP有什么缺陷,HTTPS是怎么解决的

缺陷 HTTP是明文的&#xff0c;谁都能看得懂&#xff0c;HTTPS是加了TLS/SSL加密的&#xff0c;这样就不容易被拦截和攻击了。 SSL是TLS的前身&#xff0c;他俩都是加密安全协议。前者大部分浏览器都不支持了&#xff0c;后者现在用的多。 对称加密 通信双方握有加密解密算法…

python自学3

第一节第六章 数据的列表 列表也是支持嵌套的 列表的下标索引 反向也可以 嵌套也可以 列表的常用操作 什么是列表的方法 学习到的第一个方法&#xff0c;index&#xff0c;查询元素在列表中的下标索引值 index查询方法 修改表功能的方法 插入方法 追加元素 单个元素追加 多…

YOLO v9训练自己数据集

原以为RT-DETR可以真的干翻YOLO家族&#xff0c;结果&#xff0c;&#xff01;&#xff01;&#xff01;&#xff01; 究竟能否让卷积神经网络重获新生&#xff1f; 1.数据准备 代码地址&#xff1a;https://github.com/WongKinYiu/yolov9 不能科学上网的评论区留言 数据集…

教育知识与能力保分卷一(中学)

2.在教育学的发展过程中&#xff0c;代表马克思主义的教育学著作是&#xff08;A &#xff09;。 A.凯洛夫的《教育学》 B.赞可夫的《教学与发展》 C.杜威的《民主主义与教育》 D.昆体良的《论演说家的教育》 8.小贺在一次期…

电脑不小心格式化了,怎么恢复?

在这个数字化时代&#xff0c;电脑已经成为我们日常生活和工作中不可或缺的工具。然而&#xff0c;有时我们可能会不小心格式化电脑硬盘&#xff0c;导致重要数据的丢失。那么&#xff0c;电脑不小心格式化了&#xff0c;怎么恢复&#xff1f; 别着急&#xff0c;在本篇攻略中&…

开源模型应用落地-qwen1.5-7b-chat与vllm实现推理加速的正确姿势(八)

一、前言 就在前几天开源社区又发布了qwen1.5版本,它是qwen2模型的测试版本。在本篇学习中,将集成vllm实现模型推理加速,现在,我们赶紧跟上技术发展的脚步,去体验一下新版本模型的推理质量。 二、术语 2.1. vLLM vLLM是一个开源的大模型推理加速框架,通过PagedAttention…

记一次openfeign反序列化异常复盘

前言 之前业务部门有2个通用响应类&#xff0c;一个是负责和前端交互的响应类AjaxResult,一个是负责和后端RPC接口交互的响应类RpcResult。一开始这两个响应类的值字段都一样&#xff0c;形如下 private Boolean success;private String message;private Integer code;private…

掌握PDF全面指南:Python开发者的高效编程技巧

掌握PDF全面指南&#xff1a;Python开发者的高效编程技巧 简介PDF基础知识PDF的结构常见用途PDF在开发中的挑战 PDF处理库介绍PyPDF2ReportLabPDFMiner辅助库 读取和分析PDF文件使用PyPDF2读取PDF文件提取PDF中的文本和元数据分析PDF结构和内容 编辑和修改PDF文件合并多个PDF文…

如何制作一个分销商城小程序_揭秘分销商城小程序的制作秘籍

打造赚钱神器&#xff01;揭秘分销商城小程序的制作秘籍 在这个数字化高速发展的时代&#xff0c;拥有一个属于自己的分销商城小程序&#xff0c;已成为众多商家和创业者的必备利器。它不仅能够快速搭建起自己的在线销售渠道&#xff0c;还能够利用分销模式&#xff0c;迅速裂…

C# 对文件、文件夹的操作

在使用后面的代码前&#xff0c;需要&#xff1a; using System; using System.IO;C# 对文件的操作 判断文件是否存在 string filePath "E:\\new folder\\test\\myfile.xls"; if (File.Exists(filePath)) {// 如果文件存在 } else {// 如果文件不存在 }复制文件 …