次の .gitconfig があります。
[user]
name = name
email = email@email.com
custom_field = AAA
git の組み込みコマンドを使用すると、名前と電子メールを簡単に取得できます。
custom_field の値を取得するにはどうすればよいですか?
次の .gitconfig があります。
[user]
name = name
email = email@email.com
custom_field = AAA
git の組み込みコマンドを使用すると、名前と電子メールを簡単に取得できます。
custom_field の値を取得するにはどうすればよいですか?
カスタム フィールドの名前にアンダースコアが含まれているため、コマンドが失敗しています。カスタム フィールドをファイルに追加するには、次の.gitconfig
コマンドを使用します。
git config --global user.customfield <value>
その後、次の方法で取得できます。
git config --global user.customfield
例えば:
$ git config --global user.customfield test
$ git config --global user.customfield
test
また、_
カスタム フィールド名に 's を使用しないでください。Git はそれらを解析しません:
$ git config user.custom_field test
error: invalid key: user.custom_field