Git之查看設定檔--如fatal:unable to read config file

來源:互聯網
上載者:User

Git 提供git config 工具,用來配置或讀取相應的工作環境變數。如何讀取這些配置資訊。當讀取system系統級配置資訊時,為什麼會出現

 fatal: unable to read config file 'D:\Program Files\Git\mingw64/etc/gitconfig':

No such file or directory   。。。

Git具有三個設定檔:

1. 版本庫級設定檔(.git/config) 配置僅僅針對當前項目有效; 若使用 git config 時用 --local選項,讀寫的就是這個檔案。 2. 全域設定檔(~/.gitconfig ) 使用者目錄下的設定檔只適用於該使用者; 若使用 git config 時用 --global選項,讀寫的就是這個檔案。 3. 系統級設定檔(/etc/gitconfig ) 系統中對所有使用者都普遍適用的配置; 若使用 git config 時用 --system選項,讀寫的就是這個檔案。

注意----優先順序

版本庫級設定檔 > 全域設定檔 > 系統級設定檔 因此,每一個層級的配置都會覆蓋上層的相同配置.

用git config命令查看設定檔

命令參數 –list, 簡寫 -l 格式:git config [–local|–global|–system] -l 查看版本庫級的config----------命令:git config --local -l 查看全域級的config------------命令:git config --global -l 查看系統級的config------------命令:git config --system -l(系統級設定檔找不到) 查看當前生效的配置----------命令:git config -l,這個時候會顯示最終三個設定檔計算後的配置資訊
版本庫級設定檔資訊:

全域級設定檔資訊:

系統級設定檔資訊(檔案找不到):


查看安裝目錄下etc檔案,檔案中無設定檔config
實際安裝後,該設定檔單獨在C盤/ProgramData/Git檔案中
進入C/ProgramData/Git中查看即可

查看當前生效配置




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.