dackdive's blog

新米webエンジニアによる技術ブログ。JavaScript(React), Salesforce, Python など

git config --globalのファイルの場所

ちょっと気になったのでメモ。

リポジトリ固有の git の設定は

(リポジトリのルートディレクトリ)/.git/config

というファイルに書かれているが、

$ git config --global xxx

というように --global をつけて設定したものはどこにあるのか。

http://git-scm.com/docs/git-config によると

--global

For writing options: write to global ~/.gitconfig file rather than the repository .git/config, (略)

ということで、

~/.gitconfig

というファイルだそうです。

あとは http://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to に書かれていたんだけど

$ git config --global --edit

とすると ~/.gitconfig をエディタで開くのでいきなり編集することができます。