shell变量扩展在git config

我有一个shell变量,指向所有我的配置文件所在的目录。让我们假设变量使用export RC = $ HOME / rc创建。我有一个全局忽略文件在配置目录:〜/ rc / globalgitignore。

我的问题是,我如何扩展我的.gitconfig文件中的RC变量?

我已经尝试以下:

> excludesfile = $ RC / globalgitignore
> excludesfile =!$ RC / globalgitignore
> excludesfile =!echo $ RC / globalgitignore
> excludesfile =!$(echo $ RC / globalgitignore)

这些解决方案都没有效果

这是唯一的方式,如果我输入完整的路径:excludesfile =〜/ rc / globalgitignore,但是我必须更改路径如果将我的rc目录移动到不同的位置。

你不能。 git-config(1)不支持环境变量扩展,但仅限于类型转换和路径扩展:

The type specifier can be either –int or –bool,to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int,a “true” or “false” string for bool),or –path,which does some path expansion (see –path below). If no type specifier is passed,no checks or transformations are performed on the value.

–path的文档说明:

–path

git-config will expand leading ~ to the value of $HOME,and ~user to the home directory for the specified user. This option has no effect when setting the value (but you can use git config bla ~/ from the command line to let your shell do the expansion).

术语“扩展”不会出现在git-config(1)中的任何不同的上下文中。那么你是怎么得到应该的想法,因为没有这样的特征记录在任何地方?

为了扩展环境变量,你必须自己预处理Git配置文件,即通过创建模板文件,并在将文件复制到$ HOME目录之前用脚本展开变量。

如果它是关于点文件管理,然后做,所有人做的:将它们放在一个目录,并从$ HOME添加符号链接到此目录。

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...