gitgit-config

git config --global user.email "some@email.com" throws "error: only one config file at a time."


Using git config user.email "some@email.com" sets user email in global config file.

Using git config --global user.email "some@email.com" or git config --local user.email "some@email.com" (from within a repo) throws:

"error: only one config file at a time."

My global .gitconfig:

[color]
  ui = auto
[user]
  name = My Name
  email = my@email.com
[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
  type = cat-file -t
  dump = cat-file -p
[push]
  default = simple
[core]
  autocrlf = true

What should I change to be able to have separate user.name/email for global config and local/repo config?


Solution

  • git config --global does not seem to work when the environment variable GIT_CONFIG is set.

    Try to unset GIT_CONFIG and then list your global config with

    unset GIT_CONFIG
    git config --global --list