I have the following .gitconfig:
[user]
name = name
email = [email protected]
custom_field = AAA
Getting name and email is easy using git config
.
How can I get the value of custom_field :
$ git config --global user.custom_field
error: invalid key: user.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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With