gitignore我的Windows用户名 [英] gitignore my windows username
问题描述
My Keil项目经常存储一个 .username
文件,我想用gitignore忽略它。
我认为我可以在中执行
,因为 *。$(echo%username%)
.gitignore echo%username
会在常规的Windows提示符下打印我的名字。我使用git bash,并且显然它不能获取这些全局变量(路径,用户名,appdata等)。
我怎样才能达到目标?
写在 .gitignore
文件中的模式是完全静态的,你不能使用像 shell
这样的语言来创建高级模式。
相反,你可以使用一个额外的.gitignore文件本地您的版本库:
git config core.excludesfile .my_gitignore
这个命令告诉git有一个额外的文件,它应该查找要忽略的文件模式(这里的文件名为 这是一个本地配置,因此,每个用户都必须发出相同的命令并创建它们的 My Keil projects often store a I thought I could do How can I achieve my goal? The patterns written in a Instead, you could use an additional .gitignore file local to your copy of the repository: This command tells git that there is an extra file in which it should look for file patterns to ignore (here, the file is named That is a local configuration, therefore, every user will have to issue the same command and create their 这篇关于gitignore我的Windows用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!)。
.my_gitignore
手动添加静态 *。username
规则,但是每个人都有自己的(并且只有他们自己的) 。.username
file which I want to ignore using gitignore. *.$(echo %username%)
in my .gitignore
, since echo %username
will print my name in the regular Windows prompt. I am using git bash, and appearently it cannot fetch these global variables (path, username, appdata etc). .gitignore
file are completely static, you can't use a language like shell
to make advanced patterns.git config core.excludesfile .my_gitignore
.my_gitignore
)..my_gitignore
file by hand to add a static *.username
rule, but everyone will have their own (and only theirs).