当前位置: 首页 > news >正文

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/

相关文章:

Installing Git (安装 Git)

Installing Git [安装 Git] 1. Installing Git1.1. Description1.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 …...

Android 拍照本地图片选择框架适配

前言 通常技术方案的选择、会带来后续一些不可控的东西&#xff0c;这也是没法避免的&#xff0c;程序开发者中同时面对、测试、领导、产品各种要求。同时在网络上查找的资料也只是很旧的&#xff0c;不一定适合新设备&#xff0c;需要推倒重新弄 1、解决方案通过意图选择器做…...

06 - ip route和route -n的区别

1 ip route和route -n的区别 ip route 和 route -n 都是用于查看和管理Linux系统路由表的命令。但下面是它们的区别&#xff1a; ip route&#xff1a;是Linux系统中的现代工具&#xff0c;它属于iproute2套件&#xff1b;它提供了更多的选项&#xff0c;可以更精确地控制路由表…...

JAVA设计模式——单例模式

单例模式是一种创建型设计模式&#xff0c;其主要目的是确保一个类只有一个实例&#xff0c;并提供一个全局访问点来访问这个实例。单例模式通常用于需要在整个应用程序中共享某个资源或控制某个独占性资源的情况。 在单例模式中&#xff0c;通常会将类的构造函数设为私有&…...

分巧克力 刷题笔记

/* 分巧克力 解题思路 二分 直接检查看答案是否符合题目条件 对于一块边长分别为x 和y的巧克力\\ 假设我们输入检查的数为k 其能分割成的 k*k 的巧克力的块数为 (x/k)*(y/k) 因为c里面的除法是下取整的所以我们不用考虑奇偶数 是否能整除 将每一块巧克力能分成的k*k的巧克力…...

Python图像处理【21】基于卷积神经网络增强微光图像

基于卷积神经网络增强微光图像 0. 前言1. MBLLEN 网络架构2. 增强微光图像小结系列链接 0. 前言 在本节中&#xff0c;我们将学习如何基于预训练的深度学习模型执行微光/夜间图像增强。由于难以同时处理包括亮度、对比度、伪影和噪声在内的所有因素&#xff0c;因此微光图像增…...

【嵌入式——QT】QTreeWidget

QTreeWidget类是创建和管理目录树结构的类&#xff0c;QTreeWidget每一个节点都是一个QTreeWidgetItem对象&#xff0c;添加一个节点前需先创建。QTreeWidget类是一个便利类&#xff0c;它提供了一个标准的树widget&#xff0c;具有经典的基于item的界面&#xff0c;类似于Qt 3…...

SQL 术语:Join 中的 Build 和 Probe 是什么意思?

博主历时三年精心创作的《大数据平台架构与原型实现&#xff1a;数据中台建设实战》一书现已由知名IT图书品牌电子工业出版社博文视点出版发行&#xff0c;点击《重磅推荐&#xff1a;建大数据平台太难了&#xff01;给我发个工程原型吧&#xff01;》了解图书详情&#xff0c;…...

HTTP头部信息解释分析(详细整理)

这篇文章为大家介绍了HTTP头部信息&#xff0c;中英文对比分析&#xff0c;还是比较全面的&#xff0c;若大家在使用过程中遇到不了解的&#xff0c;可以适当参考下 HTTP 头部解释 1. Accept&#xff1a;告诉WEB服务器自己接受什么介质类型&#xff0c;*/* 表示任何类型&#…...

探究短链接生成算法

1. 引言 在互联网时代&#xff0c;链接是连接用户和信息的桥梁&#xff0c;而长链接可能会因为过长、难记、不美观等问题影响用户体验&#xff0c;因此短链接的出现填补了这一空缺。短链接是将原始的长链接通过一定的算法转换成短字符串&#xff0c;从而实现了链接的简洁化&am…...

golang 实现http请求的调用,访问并读取页面数据和内置的一些方法

下午就不能好好学习一下golang&#xff0c;业务一直找个不停&#xff0c;自己定的业务规则都能忘得一干二净&#xff0c;让你查半天&#xff0c;完全是浪费时间。 golang实现访问并读取页面数据 package mainimport ("fmt""net/http" )var urls []string{…...

FFmpeg+OpenCV开发案例汇总

桌面共享工具&#xff08;软编版&#xff09; 桌面共享工具&#xff08;DXGI硬编版&#xff09; 智能广告大屏&#xff08;可叠加透明广告&#xff09; Android手机屏幕RTMP推流工具&#xff08;推麦克风版&#xff09; Android手机屏幕RTMP推流工具&#xff08;推扬声器版…...

PySide6+VSCode Python可视化环境搭建

pip install pyside6 下载本期源码 vscode装一个PYQT Integration插件&#xff0c;设置好两个路径&#xff08;下面有个脚本用于获取路径&#xff09; 用everything的童鞋注意了&#xff1a;工具/选项/索引/强制重建 重启vscode可以看到&#xff0c;右击.ui文件时出现可以操作…...

【设计】设计一个web版的数据库管理平台后端精要

需求 springboot设计开发一个系统&#xff0c;在这个系统的数据库表中存放着2000个数据库实例&#xff0c;有MySQL、Oracle、sql server3种数据库类型&#xff0c;用户可以在页面上选择不同的实例&#xff0c;连接这些实例上的数据库&#xff0c;来执行业务sql 实现 Service…...

没有硬件基础可以学单片机吗?

没有硬件基础可以学单片机吗&#xff1f; 在开始前我分享下我的经历&#xff0c;我刚入行时遇到一个好公司和师父&#xff0c;给了我机会&#xff0c;一年时间从3k薪资涨到18k的&#xff0c; 我师父给了一些 电气工程师学习方法和资料&#xff0c;让我不断提升自己&#xff0c…...

ChatGPT引领的AI面试攻略系列:cuda和tensorRT

系列文章目录 cuda和tensorRT&#xff08;本文&#xff09;AI全栈工程师 文章目录 系列文章目录一、前言二、面试题1. CUDA编程基础2. CUDA编程进阶3. 性能优化4. TensorRT基础5. TensorRT进阶6. 实际应用与案例分析7. 编程与代码实践8. 高级话题与趋势 一、前言 随着人工智能…...

【战略前沿】人形机器人制造商Figure获得了OpenAI、Jeff Bezos、Nvidia和其他科技巨头的资助

原文&#xff1a;Humanoid robot-maker Figure gets funding from OpenAI, Jeff Bezos, Nvidia, and other tech giants 作者&#xff1a;ASSOCIATED PRESS ———————————————— Figure成立不到两年&#xff0c;还没有商业产品&#xff0c;但正在说服有影响力的…...

多块磁盘组磁盘离线导致VSAN存储崩溃的VSAN数据恢复案例

VSAN简介&#xff1a; VSAN是以vSphere内核为基础进行开发、可扩展的分布式存储架构。VSAN存储层由VSAN控制和管理&#xff0c;VSAN存储层是通过vSphere集群主机中闪存和硬盘的存储空间构建的&#xff0c;供vSphere集群使用的统一共享存储层。 VSAN存储是一个对象存储&#xff…...

Jenkins 的安装(详细教程)

文章目录 一、简介二、安装前准备三、windows 安装与启动1. 方式一2. 方式二3. 方式三 四、创建管理员用户五、常用设置1. 配置镜像地址2. 更改工作目录3. 开启可注册用户4. 全局变量配置 一、简介 官网&#xff1a;https://www.jenkins.io 中文文档&#xff1a;https://www.j…...

使用html网页播放多个视频的几种方法

前言 因为项目测试需要&#xff0c;我需要可以快速知道自己推流的多路视频流质量&#xff0c;于是我想到可以使用html网页来播放视频&#xff0c;实现效果极其简单&#xff0c;方法有好几种&#xff0c;以下是几种记录&#xff1a; 注意&#xff1a;测试过&#xff0c;VLC需要使…...

革新性插件本地化突破:Obsidian-i18n让所有插件无缝切换你的语言

革新性插件本地化突破&#xff1a;Obsidian-i18n让所有插件无缝切换你的语言 【免费下载链接】obsidian-i18n 项目地址: https://gitcode.com/gh_mirrors/ob/obsidian-i18n 问题发现&#xff1a;当插件界面成为使用障碍 你是否曾遇到这样的场景&#xff1a;好不容易找…...

django让所有的静态文件都需要登录才能访问-----exoplayer设置cookie

禁止apache直接访问&#xff1a;设置&#xff1a;/etc/apache2/sites-available/000-default.conf<Directory "/var/www/html/music">Require all denied </Directory>def get_music(request,filename):file_path f"/var/www/html/music/{filename…...

ComfyUI视频工作流解决方案:从图像序列到专业视频输出的完整指南

ComfyUI视频工作流解决方案&#xff1a;从图像序列到专业视频输出的完整指南 【免费下载链接】ComfyUI-VideoHelperSuite Nodes related to video workflows 项目地址: https://gitcode.com/gh_mirrors/co/ComfyUI-VideoHelperSuite 还在为ComfyUI中复杂的视频处理流程而…...

Docker部署AnythingLLM踩坑记:解决SQLite数据库文件无法打开的权限问题

Docker部署AnythingLLM权限问题深度解析&#xff1a;从SQLite报错到容器用户管理实践 部署AnythingLLM时遇到SQLite unable to open database file错误&#xff1f;这背后隐藏着Docker容器用户权限管理的核心知识。本文将带你从表面错误深入到容器用户权限体系的本质&#xff0…...

Janus-Pro-7B人力资源:简历截图信息抽取+岗位匹配度分析报告

Janus-Pro-7B人力资源&#xff1a;简历截图信息抽取岗位匹配度分析报告 1. 引言&#xff1a;智能招聘的新助手 招聘工作最头疼的是什么&#xff1f;每天收到上百份简历&#xff0c;一份份看下来眼睛都花了。更麻烦的是&#xff0c;还要手动从简历里提取关键信息&#xff0c;再…...

弦音墨影在影视鉴赏中的创新应用:自然语言解析千里江山图式影像

弦音墨影在影视鉴赏中的创新应用&#xff1a;自然语言解析千里江山图式影像 1. 系统概述与核心价值 「弦音墨影」是一款将尖端人工智能技术与东方美学深度融合的视频理解系统。它基于Qwen2.5-VL多模态大模型&#xff0c;为用户提供了一种全新的视频内容交互体验——通过自然语…...

MOSFET栅极电阻选型实战:从波形分析到最佳阻值确定(附IRF540实测数据)

MOSFET栅极电阻选型实战&#xff1a;从波形分析到最佳阻值确定&#xff08;附IRF540实测数据&#xff09; 在电力电子设计中&#xff0c;MOSFET的栅极电阻选型往往被工程师视为"小问题"&#xff0c;但实际调试中却可能成为影响系统稳定性的关键因素。记得去年参与一款…...

OpenClaw多模型对比:Gemma-3-12b-it与Qwen在自动化任务中的表现

OpenClaw多模型对比&#xff1a;Gemma-3-12b-it与Qwen在自动化任务中的表现 1. 测试背景与实验设计 去年夏天&#xff0c;当我第一次尝试用OpenClaw自动化处理日常办公任务时&#xff0c;面对琳琅满目的大模型选项陷入了选择困难。作为个人开发者&#xff0c;既希望模型足够聪…...

【书生·浦语】internlm2-chat-1.8b效果展示:中文诗歌创作+格律校验双能力

【书生浦语】internlm2-chat-1.8b效果展示&#xff1a;中文诗歌创作格律校验双能力 当AI不仅能写诗&#xff0c;还能自己检查格律——这才是真正的"诗人助手" 1. 模型简介&#xff1a;小而精的诗歌创作专家 InternLM2-Chat-1.8B虽然只有18亿参数&#xff0c;但在中文…...

Qwen3-Reranker-0.6B实战案例:跨语言技术文档智能筛选系统

Qwen3-Reranker-0.6B实战案例&#xff1a;跨语言技术文档智能筛选系统 1. 引言&#xff1a;技术文档管理的痛点与解决方案 在全球化技术团队协作中&#xff0c;工程师们经常面临这样的困境&#xff1a;当需要查找某个技术问题的解决方案时&#xff0c;面对的是分散在Confluen…...