git别名中的多个git配置

git别名中的多个git配置,git,config,Git,Config,我想设置git别名以快速配置我的user.name和user.email 我尝试使用--add选项,但无法执行以下操作: [alias] cfTest = config --add user.email "test@test.com" --add user.name "test" 我得到的只是: error: wrong number of arguments 我想用git alias来做,但如果不可能,我会用常规的bash alias来做 怎么办?您不能将-add选项多次传递给单个gi

我想设置git别名以快速配置我的
user.name
user.email

我尝试使用
--add
选项,但无法执行以下操作:

[alias]
  cfTest = config --add user.email "test@test.com" --add user.name "test"
我得到的只是:

error: wrong number of arguments
我想用git alias来做,但如果不可能,我会用常规的bash alias来做


怎么办?

您不能将-add选项多次传递给单个
git config
命令,您需要调用
git config
两次

[aliasl]
     cfgTest = !git config user.name "Andy" && git config user.email "Andrew@nowhere.com"

--add
标志的说明如下:在不更改任何现有值的情况下向选项添加新行。这与提供
^$
作为
--replace all
中的值\u regex相同。我认为这不是你想要的。
[aliasl]
?那是打字错误吗?太好了,谢谢=)你怎么发现的?让我想起一个vim
bash命令-“如果别名扩展的前缀是感叹号,它将被视为shell命令”