c# - 远程拒绝主 -> 主(预接收挂钩被拒绝)错误:未能将一些参考推送到
问题描述
我几乎整天都被这个问题困住了,尽管有一些解决方案,但我还没有找到任何合适的解决方案。无论我做什么,错误对我来说总是一样的。所以,我创建了这个项目来学习已经有 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 的新手,所以我可能犯了错误或遗漏了一些东西,这就是为什么据我所知,我已经添加了所有内容,如果缺少任何信息,我会添加它。
这就是为什么我认为(以我有限的基础知识)可能是原因:
- 我使用的构建包https://github.com/noliar/dotnet-buildpack太旧了,可能不适用于几周前创建的 .NET 项目。
- 我写的代码
program.cs
可能是错误的,因为在我更新了 main 方法后我无法运行该项目,当我在本地运行它时它只是不断加载和加载。 git remote -v
显示四个可能只是它们必须是两个,它会造成混淆并导致错误。- 有一些解决方案正在谈论一个名为的文件
app.json
,而我的项目中没有任何此类文件,您可以在此处查看完整项目:https ://github.com/thechaudharysab/IBJOffice
所以这些是我的猜测。真的会适当的任何帮助。
解决方案
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
.
这个检查是非常基础的。因此,即使您现在将此文件添加到您的项目中,您也可能会遇到其他问题。
推荐阅读
- java - Swagger 可以从 Java 中的注解生成示例吗?
- c++ - 继承中程序的输出
- sql - 根据中断值拆分数据
- asp.net-core - .NetCore Web API:在托管服务器中放置和删除时出现错误 403
- spring - 如何使用骆驼apache将xml转换为csv
- r - 为什么打印列表命令会更改 r 中的时区?
- python - Python - 每天从一个特定时间选择数据
- javascript - 需要有关允许澳大利亚手机和电话号码的正则表达式的帮助
- javascript - 何时使用 useState() 钩子的功能更新形式,例如。集合X(x=>x+1)
- amazon-s3 - Thanos 在 S3 中缺少指标