- 打开 PowerShell 终端。
- 确保你的系统已经安装了 Chocolatey 包管理器。如果没有安装,可以通过以下步骤安装:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- 安装 Git,执行以下命令:
choco install git -y
这将自动安装 Git 并将其添加到系统路径中,以便在 PowerShell 中直接使用。完成后,你可以验证 Git 是否成功安装,通过在 PowerShell 中运行以下命令来检查 Git 的版本:
git --version
如果显示了 Git 的版本信息,则说明安装成功。