【问题标题】:.gitignore file is not generated automatically.gitignore 文件不会自动生成
【发布时间】:2020-01-16 18:46:57
【问题描述】:

我用git init 初始化了一个空的 git 存储库,它只创建了一个 .git 文件夹。它不是在制作 .gitignore 本身。当我尝试制作 .gitignore 文件然后写 \node_modules 时,它并没有忽略 node_modules 文件夹。我在 NodeJs 应用程序上使用 Linux 操作系统,并在 GitHub 上推送代码。

【问题讨论】:

  • 1.为什么会呢? 2、node_modules/呢?
  • 我猜.gitignore是自动生成的?
  • 当证据表明不是这样时,您是否重新审视了那个猜测?
  • 尝试通过gitignore.io 生成.gitignore - 您需要先将其提交到您的存储库,然后它才会开始正确忽略文件。
  • @Manangoel 为什么你“猜到”.gitignore是自动生成的?不是。

标签: node.js git ubuntu github


【解决方案1】:

它不会自动生成。您需要先在 repo 中提交它,然后在 .gitignore 文件中使用“node_module/”。

$ cat .gitignore 
node_modules/

【讨论】:

    【解决方案2】:

    如下尝试。

    • 做git init
    • 添加.gitignore文件
    • 添加文件路径或文件夹路径 想避免
    • 以Git ignore file added 或其他方式提交。
    • 推送到存储库

    然后如果它不起作用, Clone it to another folder。它会起作用的,当然。

    【讨论】:

      猜你喜欢
      • 2018-06-13
      • 1970-01-01
      • 2016-09-30
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多