当我尝试着将我的应用推向Heroku时,我得到了这样的回应:

fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我尝试过“heroku keys:add”,但仍然得到相同的结果。 我已经有一个ssh密钥为我的GitHub帐户。


当前回答

我必须以管理员权限运行Windows命令提示符

其他回答

在我的情况下,我已经登录了,我只是执行了git push。

也许值得检查一下。git文件夹中的配置文件。如果heroku参数缺失,那么你将得到这个错误heroku参数

[remote "heroku"]
    url = git@heroku.com:`[Your heroku app].git
    fetch = +refs/heads/*:refs/remotes/heroku/*

.git文件夹应该在你在heroku中创建的应用的本地计算机文件目录中。c:\ users \ you \你的app.git

希望这能有所帮助

我忘了在运行git push heroku main之前创建一个域名。创建域名解决了这个问题。

以下是Heroku官方文章:

初始化GIT

$ cd myapp
$ git init

$ git add .
$ git commit -m "my first commit"

然后创建(初始化)heroku应用程序:

$ heroku create YourAppName

最后添加git远程:

$ heroku git:remote -a YourAppName

现在你可以安全地部署你的应用程序:

$ git push heroku master

您应该等待一段时间,看看在部署时控制台是否没有任何错误/中断。详情请看heroku的文章。

遵循以下步骤:

$ heroku login

创建一个新的Git存储库 在新目录或现有目录中初始化git存储库

$ cd my-project/
$ git init
$ heroku git:remote -a appname

部署应用程序 将代码提交到存储库,并使用Git将其部署到Heroku。

$ git add . 
$ git commit -am "make it better"
$ git push heroku master

现有Git存储库 对于现有的存储库,只需添加heroku远程

$ heroku git:remote -a appname