全局Git忽略 [英] Global Git ignore

查看:179
本文介绍了全局Git忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经添加了一个 .gitignore 文件到我的用户根目录( Users / me / ),我已经添加了以下行:

<$ p $但是它并不会忽略这种类型的文件,因为这些文件不会被忽略,任何想法我做错了什么?

解决方案

您需要设置您的全局 core.excludesfile 配置文件指向这个全局忽略文件。



例如

* nix:

  git config --global core.excludesfile'〜/ .gitignore'

Windows git bash:

  git config --global core.excludesfile'〜/ .gitignore'

Windows cmd:

  git config --global core.excludesfile%USERPROFILE%\.gitignore

对于Windows,它设置为位置C:/ users / {myusername} /。gitignore。
上面的命令只会设置git将使用的忽略文件的位置。该文件必须在该位置手动创建,并填入忽略列表(来自 muruge 的评论)



您可以阅读 https://help.github.com/articles/ignoring-files/#create-a-global-gitignore


I want to set up Git to globally ignore certain files.

I have added a .gitignore file to my user root directory (Users/me/) and I have added the following line to it:

*.tmproj

But it is not ignoring this type of files, any idea what I am doing wrong?

解决方案

You need to set up your global core.excludesfile configuration file to point to this global ignore file.

e.g.

*nix:

git config --global core.excludesfile '~/.gitignore'

Windows git bash:

git config --global core.excludesfile '~/.gitignore'

Windows cmd:

git config --global core.excludesfile "%USERPROFILE%\.gitignore"

For Windows it set to the location C:/users/{myusername}/.gitignore. The above command will only set the location of the ignore file that git will use. The file has to still be manually created in that location and populated with the ignore list.(from muruge's comment)

You can read about the command at https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

这篇关于全局Git忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆