Git 裡查看 configuration

在 Git 裡查看 configuration (設定) 有幾種常用方式,依照範圍不同可以看到不同層級的設定:


🔍 查看目前生效的設定

  • 所有層級合併後的設定:
    git config --list
    
    或者:
    git config -l
    
    會列出 Git 目前使用的所有設定(包含系統、全域、專案)。

🏠 層級區分

Git 的設定分成三層:

  1. 系統層級 (system):對整台電腦的所有使用者生效
    git config --system --list
    
  2. 使用者層級 (global):對當前使用者帳號生效
    git config --global --list
    
  3. 專案層級 (local):只對當前 Git 專案生效
    git config --local --list
    

📄 查看設定檔位置

  • 系統層級:通常在 /etc/gitconfig
  • 使用者層級:通常在 ~/.gitconfig
  • 專案層級:在專案目錄下 .git/config
    可以直接用文字編輯器打開來看,例如:
cat ~/.gitconfig
cat .git/config

🎯 查看特定設定

如果只想看某一個 key,例如使用者名稱:

git config user.name
git config user.email

Also See

File14FileLast Modified
把目前repo 所有的branch都push 到github把目前repo 所有的branch都push 到github2:24 PM - January 12, 2026
把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch2:24 PM - January 12, 2026
從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題2:24 PM - January 12, 2026
git指定初始化的 branch 名稱git指定初始化的 branch 名稱2:24 PM - January 12, 2026
github上的repo clone下來check out 某一個dev branchgithub上的repo clone下來check out 某一個dev branch2:24 PM - January 12, 2026
github一台電腦同時使用兩個 GitHub 帳號github一台電腦同時使用兩個 GitHub 帳號2:24 PM - January 12, 2026
github actionsgithub actions2:24 PM - January 12, 2026
git 重新再從github上pull 所有branchgit 重新再從github上pull 所有branch2:24 PM - January 12, 2026
git 恢復到最近一次 git pull狀態,取消本地修改git 恢復到最近一次 git pull狀態,取消本地修改2:24 PM - January 12, 2026
git 初始化與推送流程圖git 初始化與推送流程圖2:24 PM - January 12, 2026
git 中查看commit歷史資訊git 中查看commit歷史資訊2:24 PM - January 12, 2026
git 中修改檔名且保留原來commit紀錄git 中修改檔名且保留原來commit紀錄2:24 PM - January 12, 2026
git Remote 常見情境與操作git Remote 常見情境與操作2:24 PM - January 12, 2026
git GUI tool, SourceTreegit GUI tool, SourceTree2:24 PM - January 12, 2026