【Git】-- Git安装 & 卸载(ubuntu)

文章目录

  • [1. Git安装 & 卸载--ubuntu](#1. Git安装 & 卸载--ubuntu)

更多Git相关知识: Git专栏

1. Git安装 & 卸载--ubuntu

检查是否安装

命令:git --version.

已安装:

bash 复制代码
root@VM-0-3-ubuntu:~# git --version
git version 2.43.0

未安装:

bash 复制代码
oot@VM-0-3-ubuntu:~# git --version
-bash: /usr/bin/git: No such file or directory

1.1 安装

bash 复制代码
root@VM-0-3-ubuntu:~# sudo apt-get install git -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  eatmydata libeatmydata1 python3-json-pointer python3-jsonpatch python3-jsonschema python3-pyrsistent
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  git
0 upgraded, 1 newly installed, 0 to remove and 301 not upgraded.
Need to get 3,680 kB of archives.
After this operation, 22.2 MB of additional disk space will be used.
Get:1 http://mirrors.tencentyun.com/ubuntu noble-updates/main amd64 git amd64 1:2.43.0-1ubuntu7.3 [3,680 kB]
Fetched 3,680 kB in 0s (44.9 MB/s)
Selecting previously unselected package git.
(Reading database ... 100948 files and directories currently installed.)
Preparing to unpack .../git_1%3a2.43.0-1ubuntu7.3_amd64.deb ...
Unpacking git (1:2.43.0-1ubuntu7.3) ...
Setting up git (1:2.43.0-1ubuntu7.3) ...
Scanning processes...                                                                                                                                        
Scanning linux images...                                                                                                                                     
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

root@VM-0-3-ubuntu:~# git --version
git version 2.43.0

1.2 卸载

bash 复制代码
root@VM-0-3-ubuntu:~# sudo apt-get remove git -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  eatmydata libeatmydata1 liberror-perl python3-json-pointer python3-jsonpatch python3-jsonschema python3-pyrsistent
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  git ubuntu-server
0 upgraded, 0 newly installed, 2 to remove and 301 not upgraded.
After this operation, 22.2 MB disk space will be freed.
(Reading database ... 101824 files and directories currently installed.)
Removing ubuntu-server (1.539) ...
Removing git (1:2.43.0-1ubuntu7.3) ...
相关推荐
电化学仪器白超2 小时前
小乌龟Git全程图形化操作指南:嵌入式本地版本管理与Gitee私有云备份实战
git·python·单片机·嵌入式硬件·物联网·gitee·自动化
K3v5 小时前
【git】删除本地以及远端已经合并到master的分支
大数据·git·elasticsearch
Elastic 中国社区官方博客8 小时前
Elasticsearch:快速近似 ES|QL - 第二部分
大数据·数据库·sql·elasticsearch·搜索引擎·全文检索
云攀登者-望正茂9 小时前
将 develop 分支拉取到特性分支时解决合并污染问题
git
Rsun045519 小时前
IDEA隐藏无关文件
java·elasticsearch·intellij-idea
萑澈9 小时前
实践教程:我如何用 n8n 自动化“软著申请”中最头疼的文档撰写工作
运维·elasticsearch·自动化
Jeremy_Lee12311 小时前
Claude Code + OpenSpec + Everything Claude Code AI 协同开发实战指南
人工智能·elasticsearch·everything
金銀銅鐵12 小时前
[git] 如何找到已经“丢失”的 commit?
git·后端
尘世壹俗人12 小时前
linux编译安装git
linux·运维·git
李昊哲小课13 小时前
WSL Ubuntu 24.04 GPU 加速环境完整安装指南
c++·pytorch·深度学习·ubuntu·cuda·tensorflow2