首页 > 解决方案 > Heroku 构建失败,“致命:不是 git 存储库”

问题描述

我正在尝试将我的应用程序部署到 Heroku,但不断收到错误消息

fatal: Not a git repository (or any parent up to mount point /tmp) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'

在我输入的命令下

$ git branch 
    -> master

$ git add -A

$ git commit -m'commit'
    ...your branch is up to date

$ git push

    everything-up-to-date

$ heroku create drumbo

    Creating ⬢ drumbo... done
    https://drumbo.herokuapp.com/ | https://git.heroku.com/drumbo.git

$ heroku buildpacks:set heroku/nodejs

    Buildpack set. Next release on sampleapp will use heroku/nodejs.
    Run git push heroku master to create a new release using this buildpack.

$ git init (added this in because of https://stackoverflow.com/questions/16853624/git-discovery-across-filesystem-not-set)

    Reinitialized existing Git repository in /Users/Berta/Desktop/Codes-senior/sampleapp/.git/

$ git push heroku master

    ...(fails with) - fatal: Not a git repository (or any parent up to mount parent /home/kozi) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

$ git status 

    On branch master
    your branch is up to date with 'origin/master'.
    nothing to commit, working tree clean

$ ls -A 

    ... .git, .github ...

终端日志中也有相当多的关于 npm-merge-driver 的废话。看起来构建在 npm install npm-merge-driver 被调用后立即失败 -

> drumbo@1.0.0 prepare /tmp/build_77f785ef804afd5c02fbe1c7b6f209fd
remote:        > npm-merge-driver install
remote:
remote:        fatal: Not a git repository (or any parent up to mount 
point /tmp)
remote:        Stopping at filesystem boundary 
(GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
remote:        
/tmp/build_77f785ef804afd5c02fbe1c7b6f209fd/node_modules/npm-merge- 
driver/node_modules/yargs/yargs.js:1100

但是,当我卸载 npm-merge-driver 时,构建失败,因为它没有找到。

发生了什么?

标签: node.jsgitgithubherokudeployment

解决方案


两件事 - 你需要从你的 package.json 文件中删除 prepare 行(应该是引用 npm-merge-driver 的行,

并且您需要确保在运行 npm run deploy 之前添加、提交和推送代码 - 应该清除所有内容


推荐阅读