git 远程拒绝主 -> 主(预接收钩拒绝)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9542665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:06:38  来源:igfitidea点击:

remote rejected master -> master (pre-receive hook declined)

git

提问by Brian McDonough

I'm working in rails 3.2 and I receive an error when I try to push to heroku:

我在 rails 3.2 中工作,当我尝试推送到 heroku 时收到一个错误:

 git push heroku master
Counting objects: 496, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (435/435), done.
Writing objects: 100% (496/496), 5.17 MiB | 249 KiB/s, done.
Total 496 (delta 125), reused 216 (delta 8)

-----> Heroku receiving push
-----> Removing .DS_Store files
 !     Heroku push rejected, no Cedar-supported app detected

To [email protected]:lumeo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:lumeo.git'

I have tried the few methods recommended on this forum, including emptying and reinstalling the Gems and deleting and adding the remote, to no avail.

我已经尝试了本论坛推荐的几种方法,包括清空并重新安装Gems以及删除和添加遥控器,均无济于事。

any suggestions?

有什么建议?

采纳答案by manojlds

Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed it fine (git statuswill help you here and a lsshould help you verify the project structure).

确保您的 Rails 应用程序位于 repo 的根目录中,Gemfile 存在并正确命名。它基本上无法将您的代码库检测为受支持的项目类型之一,因此无法通过。此外,即使您确实有一个合适的项目,请确保它是存储库的一部分并且您已经提交了它(git status在这里会帮助您,并且ls应该可以帮助您验证项目结构)。

回答by Chelsea

If you run $ heroku logsyou may get a "hint" to what the problem is. For me, Heroku could not detect what type of app I was creating. It required me to set the buildpack. Since I was creating a Node.js app, I just had to run $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs. You can read more about it here: https://devcenter.heroku.com/articles/buildpacks. No pushing issues after that.

如果您运行,$ heroku logs您可能会得到有关问题所在的“提示”。对我来说,Heroku 无法检测我正在创建的应用程序类型。它需要我设置 buildpack。因为我正在创建一个 Node.js 应用程序,所以我只需要运行$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs. 您可以在此处阅读更多相关信息:https: //devcenter.heroku.com/articles/buildpacks。之后没有推送问题。

I know this is an old question, but still posting this here incase someone else gets stuck.

我知道这是一个老问题,但仍然在这里发布以防其他人被卡住。

回答by Bora

In Heroku, you may have problems with pushing to the master branch. What you can do is to start a new branch using

在 Heroku 中,您可能会在推送到 master 分支时遇到问题。您可以做的是使用

git checkout -b tempbranch

git checkout -b tempbranch

and then push using

然后使用推送

git push heroku tempbranch

git push heroku tempbranch

回答by PanicBus

You might also want to check for Heroku telling you there's a typo in your CSS file.

您可能还想检查 Heroku 是否告诉您 CSS 文件中有拼写错误。

Read through the long boring messages in the terminal closely after you push. There may be something like this: Invalid CSS after. It means Heroku has found a typo and you need to fix it in the CSS file.

推送后仔细阅读终端中冗长乏味的消息。可能有这样的事情:Invalid CSS after. 这意味着 Heroku 发现了一个错字,您需要在 CSS 文件中修复它。

You can do a find for rake aborted!and directly after that it should say why the push failed.

您可以进行查找,rake aborted!然后直接说明推送失败的原因。

回答by februaryInk

If you get this error and the terminal is not descriptive enough to help you, Heroku might be able to tell you what is wrong through their website. Try the following:

如果您收到此错误并且终端的描述不足以为您提供帮助,Heroku 可能会通过他们的网站告诉您出了什么问题。请尝试以下操作:

  1. log in to Heroku and go to your dashboard;
  2. select the problem application from the list; and,
  3. check the build logs under the "Activity" tab.
  1. 登录 Heroku 并转到您的仪表板;
  2. 从列表中选择有问题的应用程序;和,
  3. 检查“活动”选项卡下的构建日志。

In my case, I had accidentally ignored my Gemfile.lock.

就我而言,我不小心忽略了我的 Gemfile.lock。

回答by André Villar

Specify the version of node The version of Node.js that will be used to run your application on Heroku, should also be defined in your package.json file. You should always specify a Node.js version that matches the runtime you're developing and testing with. To find your version type node --version.

指定节点版本 将用于在 Heroku 上运行应用程序的 Node.js 版本,也应在 package.json 文件中定义。您应该始终指定一个与您正在开发和测试的运行时相匹配的 Node.js 版本。要查找您的版本类型节点 --version。

Your package.json file will look something like this:

您的 package.json 文件将如下所示:

"engines": { "node": "10.x" },

“引擎”:{“节点”:“10.x”},

It should work

它应该工作

回答by Franklin Okolie

just in case you have this problem while trying to push a django app to heroku and then you get this error:

以防万一您在尝试将 django 应用程序推送到 heroku 时遇到此问题,然后出现此错误:

! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to https://git.heroku.com/app_name.git

![远程拒绝] master -> master (pre-receive hook denied) 错误:无法将一些引用推送到https://git.heroku.com/app_name.git

simply look for this :

只需寻找这个:

Error while running '$ python manage.py collectstatic --noinput'. remote: See traceback above for details. remote: remote: You may need to update the application code to resolve this error. remote: Or, you can disable collectstatic for this application: remote: remote: $ Heroku config:set DISABLE_COLLECTSTATIC=1

运行“$ python manage.py collectstatic --noinput”时出错。远程:有关详细信息,请参阅上面的回溯。远程:远程:您可能需要更新应用程序代码才能解决此错误。远程:或者,您可以为此应用程序禁用 collectstatic:远程:远程: $ Heroku config:set DISABLE_COLLECTSTATIC=1

Copy this : $ Heroku config:set DISABLE_COLLECTSTATIC=1

复制这个: $ Heroku config:set DISABLE_COLLECTSTATIC=1

and paste it in the terminal. Press Enterand after that run: $ git push Heroku master

并将其粘贴到终端中。按Enter然后运行: $ git push Heroku master

This should solve your problem if Django app is what you are trying to push.

如果 Django 应用程序是您要推送的内容,这应该可以解决您的问题。

回答by Caio Euzébio

I had the same issue.

我遇到过同样的问题。

Look at your git ignore and check if .env is not ignored.

查看您的 git ignore 并检查 .env 是否未被忽略。

It was my problem and resolved to my case.

这是我的问题并解决了我的情况。

回答by Savad KP

The package setuptools/distribute is listed in requirements.txt. Please remove the same.

包 setuptools/distribute 列在 requirements.txt 中。请删除相同的。

回答by Arta

For completeness, the issue may be heroku itself. In rare cases like these https://status.heroku.comwould show something along the lines of:

为了完整起见,问题可能是 heroku 本身。在像这些https://status.heroku.com这样的极少数情况下,会显示以下内容:

Update

The Heroku Dashboard and Elements have been restored. We are still working to restore the other affected services.

The services still affected are:

  • Builds
  • Review apps
  • Pipelines
  • Github deploys
  • Heroku CI
  • Heroku Buttons

更新

Heroku 仪表板和 Elements 已恢复。我们仍在努力恢复其他受影响的服务。

仍受影响的服务有:

  • 构建
  • 查看应用程序
  • 管道
  • Github 部署
  • Heroku CI
  • Heroku 按钮

I was able to deploy about 40 minutes later after heroku reported:

在 heroku 报告后大约 40 分钟后,我能够部署:

All affected services have been restored and are now working as expected. We will be monitoring to ensure there are no further issues.

所有受影响的服务都已恢复,现在按预期工作。我们将进行监控以确保没有进一步的问题。