Git Config File Reference?

Hello

I work with more then one Git Account.

My idea is to enter username and mail address in the config file in the .git directory.
Git returns the error value:
fatal: bad config line 8 in file .git/config

Therefore I look for the reference of the file config

[core]
repository format version = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
user.name=DonaldDuck
user.email=donaldduck@entenhausen.gov

Who can help me? Or has other ideas? I work with VS Code, if there is a more elegant solution

Thanks

The problem is that you’re adding user section settings to the core section. Two options to fix this:

  1. Use git config instead of editing the file manually (the linked documentation also describes the file format).
  2. Manually create a user section in the config file for the name and email settings, like so:
[user]
        name = Your Name
        email = name@example.com

Hello airtower-luna

Thanks for your help. I test this asap

This documentation don’t help.
I read the Section " CONFIGURATION FILE".
But i can’t find Sections like [User]

“git config” (global) is not a solution. I need different Users in in different Repos.

Thanks for your kind help

The examples there doesn’t contain a user section, yes, but you can still use it the same way (see the example in my previous post), no matter if it’s in a repository config or global config.

If editing the config file feels too complicated you can just use the git config command directly, which will adjust the config file automatically:

git config user.name Your Name
git config user.email name@example.com

git config changes the the repository configuration by default.

1 Like

The last sentence was great!

Thanks for your kind Help

1 Like