【问题标题】:GitHub Not Ignoring .gitignore DirectoriesGitHub 不忽略 .gitignore 目录
【发布时间】:2020-09-10 18:43:16
【问题描述】:

我有一个 Laravel 项目,当我推送到 GitHub 时,我的 .gitignore 目录仍然会推送到 GitHub:

git add .
git commit -m "Sample commit."
git remote add origin git@github.com:My.git
git push origin master

storage/framework/ 中的所有缓存和会话数据都被推送到 GitHub,即使 storage/framework/ 有 .gitignore。所有其他带有 .gitignore 的目录也被推送到 GitHub。

我做错了什么?

【问题讨论】:

  • 检查是否为 #1。 .gitignore 文件位于存储库的根文件夹中(不是必需的,但建议使用)#2。 gitignored 模式/路径相对于 gitignore 文件位置 #3 正确指定。 gitignore 文件中的模式是正确的。为了更清楚,您可以在代码中添加文件夹结构和 .gitignore 文件

标签: github github-actions github-cli


【解决方案1】:

.gitignore 包含有意忽略的未跟踪文件列表。

您可以检查 .gitignore 中给出的模式是否确实与您不想提交的文件/目录匹配。

【讨论】:

  • 就是这样,谢谢。我需要使用 * !.gitignore 添加 storage/framework/sessions/.gitignore
猜你喜欢
  • 1970-01-01
  • 2012-09-23
  • 1970-01-01
  • 1970-01-01
  • 2016-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多