一条命令完成Windows10 Git 安装(双语版)
本文介绍在Windows 10使用WinGet工具安装Git的方法,相比下载安装包的方式,操作更简单,快捷。
This document introduces the method of installing Git using the WinGet tool in PowerShell on Windows 10. Compared with the method of downloading the installation package, this method is simpler and faster.
WinGet 是一款命令行工具,用户可借助它在 Windows 10、Windows 11 以及 Windows Server 2025 计算机上发现、安装、升级、卸载和配置应用程序。如果你还没有安装WinGet,请先安装。
WinGet is a command line tool enabling users to discover, install, upgrade, remove and configure applications on Windows 10, Windows 11, and Windows Server 2025 computers. Install winget tool if you don’t already have it,
目录 Table of Contents
Git 介绍 Git Introduction
Git Introduction
Git 是一个免费的开源分布式版本控制系统,旨在快速高效地处理从小型到超大型的各类项目。
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git License
Git 采用 GNU General Public License version 2(GPLv2)许可协议。
Git is released under the GNU General Public License version 2.0, which is an open source license.
Git 下载和安装 Git Download and Installation
-
运行PowerShell, 然后输入“winget install --id Git.Git -e --source winget”。
Run PowerShell and then type “winget install --id Git.Git -e --source winget” in Powershell.
Windows PowerShell 版权所有 (C) Microsoft Corporation。保留所有权利。 尝试新的跨平台 PowerShell https://aka.ms/pscore6 PS C:\Users\Administrator> winget install --id Git.Git -e --source winget 已找到 Git [Git.Git] 版本 2.47.1.2 此应用程序由其所有者授权给你。 Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。 正在下载 https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.2/Git-2.47.1.2-64-bit.exe ▍ 1024 KB / 65.8 MB
-
Winget开始自动下载、安装和配置环境变量,直到安装完成。安装路径默认在C盘。
The Winget will start to automatically download, install, and configure the environment variables. The default installation path is on the C drive.
Windows PowerShell 版权所有 (C) Microsoft Corporation。保留所有权利。 尝试新的跨平台 PowerShell https://aka.ms/pscore6 PS C:\Users\Administrator> winget install --id Git.Git -e --source winget 已找到 Git [Git.Git] 版本 2.47.1.2 此应用程序由其所有者授权给你。 Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。 正在下载 https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.2/Git-2.47.1.2-64-bit.exe ██████████████████████████████ 65.8 MB / 65.8 MB 已成功验证安装程序哈希 正在启动程序包安装... 安装程序将请求以管理员身份运行,需要提示。 已成功安装 PS C:\Users\Administrator>
Git 环境检查 Git Environment Check
打开新的命令行窗口,运行“git --version”,检查能否提示git版本,如果可以,则安装和配置环境变量成功。
Open a new PowerShell window and type “git --version” to check if it can display the Git version. If it does, then the installation and the environment variables configuration have worked.
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
PS C:\Users\Administrator> git --version
git version 2.47.1.windows.2