Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Git 三大平台安裝圖解教學:Linux、macOS、Windows 全搞定

編輯:Linux 教學

Git 是現代軟體開發的基礎設施。本文提供三大主流平台的最新安裝指引,含圖文步驟與首次設定,零門檻上手。

Linux(以 Debian/Ubuntu 為例)

# 檢查是否已安裝
git --version

# 一鍵安裝(新版套件庫已改名為 git)
sudo apt update && sudo apt install git

# 舊版 Debian/Ubuntu 需用
sudo apt install git-core

其他發行版可至 官網 下載原始碼編譯:
./configure && make && sudo make install

macOS

方案 A:Homebrew(推薦開發者)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install git

方案 B:Xcode Command Line Tools(最輕量)

  1. 安裝 Xcode(App Store)或直接執行 xcode-select --install
  2. 彈出視窗點選「安裝」,內含 Git

Xcode 還提供完整 iOS/macOS 開發工具鏈,免費且官方維護。

Windows

推薦 Git for Windows(原 msysgit),內建 Bash 模擬環境、Git GUI、Git Bash,單一安裝檔搞定。

  1. 下載:https://git-scm.com/download/win
  2. 執行安裝程式,預設選項即可(建議勾選「Git from the command line and also from 3rd-party software」)
  3. 開始選單 → Git → Git Bash,出現 $ 提示符即成功

全平台通用:首次身分設定

git config --global user.name "Your Name"
git config --global user.email "email@example.com"
  • --global:當前使用者所有倉庫套用
  • 特定專案不同身分:進入專案目錄執行不加 --global

驗證安裝

git --version
git config --list

Windows 開發體驗雖不如類 Unix 系統,但 Git for Windows 已將差距縮至最小。裝好 Git,版本控制之旅正式啟程!

Copyright © Windows教程網 All Rights Reserved