首页 > 解决方案 > 远程拒绝主 -> 主(预接收挂钩被拒绝)错误:未能将一些参考推送到

问题描述

我几乎整天都被这个问题困住了,尽管有一些解决方案,但我还没有找到任何合适的解决方案。无论我做什么,错误对我来说总是一样的。所以,我创建了这个项目来学习已经有 git init 的 ASP.NET Core MVC 并将其发布在这里:https ://github.com/thechaudharysab/IBJOffice

现在,今天我决定将这个项目放到网上,看看它是否有效,或者我如何使用 Heroku 在云上实现它(因为它是免费的,而且我还不想使用 Azure)。

我在课堂上安装Microsoft.Extensions.Configuration.CommandLine并添加,然后在它的主要方法中添加:using Microsoft.Extensions.Configuration;program.cs

public static void Main(string[] args)
{
    var config = new ConfigurationBuilder().AddCommandLine(args).Build();
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseConfiguration(config)
        .UseIISIntegration()
        .UseStartup<Startup>()
        .Build();

    host.Run();
}

如果现在我检查git status没有什么要提交的,因为我的分支是最新的,在 GitHub 上使用 'origin/master'。所以现在我想将代码推送到 Heroku,为此我正在这样做:

git add .
git commit -m "heroku update'
heroku create --buildpack https://github.com/noliar/dotnet-buildpack.git -a ibjoffice
heroku git:remote -a ibjoffice
git push heroku master

每次我收到此错误时:

在此处输入图像描述

如果我写git remote -v,我会得到这四个:

在此处输入图像描述

由于我是 .NET Core 的新手,所以我可能犯了错误或遗漏了一些东西,这就是为什么据我所知,我已经添加了所有内容,如果缺少任何信息,我会添加它。

这就是为什么我认为(以我有限的基础知识)可能是原因:

所以这些是我的猜测。真的会适当的任何帮助。

标签: c#gitgithubheroku.net-core

解决方案


heroku create --buildpack https://github.com/noliar/dotnet-buildpack.git -a ibjoffice

--> https://github.com/noliar/dotnet-buildpack/blob/master/bin/detect

它检查是否存在project.json.

您的项目缺少 a project.json,因此与 buildpack 不兼容。因此Push rejected.

这个检查是非常基础的。因此,即使您现在将此文件添加到您的项目中,您也可能会遇到其他问题。


推荐阅读