【问题标题】:create-react-app git pushing node_modulescreate-react-app git 推送 node_modules
【发布时间】:2018-07-06 05:38:48
【问题描述】:

所以我尝试使用来自本地 git 构建的 create-react-app 推送我的初始提交。我的.gitignore 看起来像这样:

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production


# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

我的目录是这样的:

默认目录结构不变,为什么还要上传node_modules呢?

更新信息:

所以在我的 git 忽略中修改了它,但它似乎仍然推送了 `node_modules'。我的 git root 是 theapp > build / node_modules / public / etc...如果有帮助的话。

我继续并允许它,但在我与git push azure master 的推送结束时,我现在得到了这个:

此外,在 Windows 中,我的文件资源管理器如下所示:

还有什么想法?

【问题讨论】:

    标签: git reactjs azure gitignore create-react-app


    【解决方案1】:

    /node_modules 正在查看您的计算机 的根目录。

    你想要的是node_modules/。它会查找相对于您当前位置的目录。

    【讨论】:

    • 感谢您提供信息,但失败了。在我原来的问题中添加了附加信息。
    【解决方案2】:

    修复.gitignore 文件后,该目录仍保留在历史记录中。要从历史记录中永久删除 node_modules,请参阅 How to remove/delete a large file from commit history in Git repository?

    【讨论】:

    • 我做了一个rm -rf .git 并删除了隐藏的 git 文件夹,因此也应该删除历史记录。这不正确吗?实际上,我这样做了,做了一个 git init 并在 Azure 中重置了上游 repo。
    • @Mark 如果你想从头开始,那也可以
    猜你喜欢
    • 2019-03-19
    • 2018-06-02
    • 2018-12-18
    • 1970-01-01
    • 2017-03-17
    • 2019-12-01
    • 2017-11-09
    • 2018-06-07
    • 2023-02-09
    相关资源
    最近更新 更多