I have the following .gitconfig:
[user]
name = name
email = email@email.com
custom_field = AAA
Getting name and email is easy using git's built in commands.
How can I get the value of custom_field?
I have the following .gitconfig:
[user]
name = name
email = email@email.com
custom_field = AAA
Getting name and email is easy using git's built in commands.
How can I get the value of custom_field?
Your command is failing because you've put an underscore in the custom field's name. To add a custom field to the .gitconfig file, use this command:
git config --global user.customfield <value>
You can then retrieve it with:
git config --global user.customfield
For example:
$ git config --global user.customfield test
$ git config --global user.customfield
test
Also, avoid _'s in the custom field name. Git doesn't parse them:
$ git config user.custom_field test
error: invalid key: user.custom_field