"Heroku"似乎不是一个git仓库。

297

当我尝试将我的应用程序推送到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',但仍然出现相同的结果。 我的 GitHub 帐户已经有一个 SSH 密钥。


你使用了什么命令来推送代码?在此之前,你执行了哪些步骤? - StickMaNX
3
查看 git remote -v 的输出,了解你设置了哪些远程仓库。 - John Beynon
1
确保你在正确的目录下。那就是我的问题所在。 - tmthyjames
1
@tmthyjames - 没错,这也是我的问题,谢谢! - andy mccullough
1
这个问题是由于您的本地项目没有与Heroku上的项目链接而导致的,您应该使用heroku git:remote -a <yourapp>命令添加它,然后就可以继续了。 - Kibiku Brian
26个回答

0

如果在开发者的计算机上已经安装了Heroku,以下命令可用于Ruby on Rails应用程序在Heroku上的部署。#表示注释

  1. heroku login
  2. heroku create
  3. heroku keys:add #这会将本地机器的密钥添加到Heroku中,以避免重复输入密码
  4. git push heroku master
  5. heroku rename new-application-name #将应用程序重命名为首选名称而不是自动生成的Heroku名称

0

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


谢谢你的回答。也许你可以向OP解释一下如何做到这一点?尽可能详细地给出答案总是有帮助的,对于未来查看此线程的用户也是如此。 - niels
@niels 只需找到 cmd 图标,例如通过开始菜单。然后右键单击并选择以管理员身份运行。 - Jesus Rodriguez

0

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


0
在我的情况下,我已经登录并且只需执行git push

0

对于那些想要在codeanywhere IDE上使用heroku的人:

heroku login
git remote add heroku git@heroku.com:MyApp.git
git push heroku

0
简短回答:`$ git push {herokuappname} master`
长回答: 这是我解决问题的方法。
我从以下内容开始:
$ git push heroku master

这个有问题
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

我已经跑了。
$ heroku git:remote -a {herokuappname}

而且它没有解决我的问题。 我运行了。
$ git remote -v

得到了这个列表
origin  https://github.com/{githubusername}/{reponame} (fetch)
origin  https://github.com/{githubusername}/{reponame} (push)
{herokuappname} https://git.heroku.com/{herokuappname}.git (fetch)
{herokuappname} https://git.heroku.com/{herokuappname}.git (push)

我跑了
$ git push {herokuappname} master

并且它推送到了Heroku并部署了应用程序。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接