GitConfig:shell命令的配置错误 [英] GitConfig: bad config for shell command
本文介绍了GitConfig:shell命令的配置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某些原因,这一个不起作用。我试图设置一个别名,因为我有很多。任何想法?
[别名]
t =!git log --decorate --oneline | egrep'^ [ 0-9a-f] + \(tag:'| sed -r's /^.+ tag:([^] +)[,\)]。+ $ / \ 1 / g'
命令本身很好:
$ git log --decorate --oneline | egrep'^ [0-9a-f] + \(tag:'| sed -r's /^.+ tag:([^] +)[,\)]。+ $ / \ 1 / g '
1.0.0
0.9.0
...
$ git t
致命:bad配置文件第28行/Users/alanschneider/.gitconfig
解决方案
反斜杠( \
)字符在你的配置中被git自己读取。只需再次使用第二个反斜杠就可以逃脱它们,它将起作用:
t =!!git log --decorate --oneline | egrep'^ [0-9a-f] + \\(tag:'| sed -r's /^.+ tag:([^] +)[,\\]]。+ $ / \\ \\\1 / g'
I'm trying to set up an alias, as I have many.
For some reason, this one does not work. Any idea?
[alias]
t = "!git log --decorate --oneline | egrep '^[0-9a-f]+ \(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'"
Command works fine by itself:
$ git log --decorate --oneline | egrep '^[0-9a-f]+ \(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'
1.0.0
0.9.0
...
$ git t
fatal: bad config file line 28 in /Users/alanschneider/.gitconfig
解决方案
Backslash ("\
") characters are read by git itself in your config. Just escape them again with a second backslash and it will work:
t = "!git log --decorate --oneline | egrep '^[0-9a-f]+ \\(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\\)].+$/\\1/g'"
这篇关于GitConfig:shell命令的配置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文