gitの設定を確認するには、git config
コマンドを使います。
コマンドの書式は以下です。
> git config [<options>]
全ての設定を表示するには-l
オプションを使います。
> git config -l
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=***@***.co.jp
user.email=********
一つの項目だけ見たい場合は、git config <項目名>
とします。
> git config user.name
user.name=***@***.co.jp
gitの設定にはsystem、 global、localという3段階のロケーションがあります。
git configのオプションとして、設定値を取得するロケーションを指定できます。
> git config --global user.name
user.name=***@***.co.jp
それぞれのロケーションが設定値を読み出す場所は以下になります。
ロケーション | 読み出す場所 | 概要 |
system | /etc/gitconfig | システム全てに対する設定 |
global | ~/.gitconfig または ~/.config/git/config | システムのユーザーの設定 |
local | .git/config | リポジトリの設定 |
同じ設定値の場合、この表の下側のロケーションのものを優先して取得します。
リポジトリの設定があれば、リポジトリの設定が最優先という感じです。
gitの設定値の取得は以上です。