git - 如何阻止 Git 中某些特定类型的文件提交?

标签 git gitignore

是否可以在git commit中阻止特定文件类型(.dll,.exe)

我知道我们可以通过 .gitignore 文件来做到这一点。但我有超过 500 个 repo,所以在每个项目中添加 .gitignore 文件并不容易。

我们可以通过 per-receive 钩子(Hook)做同样的事情,但我得到 Restrict the specific type file commit in Git

有什么想法吗?

最佳答案

您可以创建一个全局 .gitignore 文件。

如何 - https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

Open Terminal.

Run the following command in your terminal:

git config --global core.excludesfile ~/.gitignore_global

关于git - 如何阻止 Git 中某些特定类型的文件提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46398263/

相关文章:

git - 如何将其他文件添加到 Chocolatey 包中?

java - 每次 git 推送都会删除未跟踪的文件

Github GitIgnore 错误

git - 为 Symfony2 项目 : why add web/bundles folder to gitignore 设置 GIT

python - 如何在弹性 beantalk 上更新 python Flask 应用程序?

git - 使用 Git 更改项目的第一次提交?

git - .gitignore 不忽略 .idea 路径

git - .gitignore 和 "The following untracked working tree files would be overwritten by checkout"

Git 删除 -- 由 TortoiseGit 缓存

git - PhpStorm 和 Git - 推送失败 - 失败,错误为 :