git config --global user.email"some@email.com"抛出"错误:一次只有一个配置文件."

Sar*_*ran 4 git git-config

使用git config user.email "some@email.com"全局配置文件中设置用户电子邮件

使用git config --global user.email "some@email.com"git config --local user.email "some@email.com"(从回购中)抛出:

"错误:一次只有一个配置文件."

我的全球.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
Run Code Online (Sandbox Code Playgroud)

我应该更改为能够为全局配置和本地/ repo配置单独的user.name/email?

小智 9

当设置环境变量GIT_CONFIG时,git config --global似乎不起作用.

尝试取消设置GIT_CONFIG,然后列出您的全局配置

unset GIT_CONFIG
git config --global --list
Run Code Online (Sandbox Code Playgroud)