当我尝试将我的应用程序推送到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键:添加',但仍然会得到相同的结果。我已经为我的GitHub帐户安装了一个ssh密钥。
要将Heroku应用程序添加为Git远程,您需要执行heroku git:remote -a yourapp
。
资料来源:Deploying with Git
我遇到了同样的错误,造成了更多的新手错误:我输入的是Heroku,大写字母为“H”,而不是小写。
我认识到,对于遇到此错误的每个人来说,肯定不是解决方案,但这是我的理由。
我得到了同样的错误,结果发现我在错误的目录中。如此仔细检查你是否在根目录然后再次运行heroku create
和heroku git push master
是一个简单的错误。当然,你必须在heroku步骤之前完成git init
,如上面的StickMaNX答案中提到的那样。
运行这个
heroku create
在推送代码之前。
对于那些试图让heroku在codeanywhere
IDE上工作的人:
heroku login
git remote add heroku [email protected]:MyApp.git
git push heroku
我必须以管理员权限运行Windows命令提示符
如果heroku已安装在开发人员计算机上,则以下命令适用于heroku上的ruby on rails应用程序部署。 #表示评论
在我的情况下,我已经登录,我刚刚执行了git push
。
我有同样的问题,但后来我发现在部署之前我忘了创建一个应用程序。在终端中尝试以下步骤。
heroku login
heroku create
我只是在学习heroku并经常忘记这些步骤所以我写了一篇关于它的文章。你可以在这里找到它:https://medium.com/@saurav.panthee/deploy-flask-app-to-heroku-under-3-minutes-2ec1c0bc403a
我在这里看到了所有的答案,唯一缺少的是经过这些步骤:
$ git add .
$ git commit -m "first heroku commit"
您应该运行以下命令:
$ heroku git:remote -a <YourAppNameOnHeroku>
最后,运行这个:
$ git push -f heroku <NameOfBranch>:master
注意我使用了<NameOfBranch>,因为如果你当前在不同的分支中掌握它仍然会抛出错误,所以如果你在master使用master,那么把分支的名称放在那里。
您可以在根目录中尝试以下操作:
//为项目初始化git,添加更改并执行提交
git init
git add .
git commit -m "first commit"
//创建heroku应用程序并推送到heroku
heroku create
git push heroku master
不知道你在这个过程中的位置。你也不需要github在heroku上部署,只需要git。希望这可以帮助!
首先,确保您已登录heroku:
heroku login
输入您的凭据。
在将克隆的git repo用于新计算机时,通常会出现此错误。即使你的heroku凭证已经在机器上,克隆的repo和heroku之间也没有链接。为此,请进入克隆仓库的根目录并运行
heroku git:remote -a yourapp
请遵循以下步骤:
$ 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
初始化GIT
$ cd myapp
$ git init
$ git add .
$ git commit -m "my first commit"
然后使用以下命令创建(初始化)heroku应用程序:
$ heroku create YourAppName
最后添加git remote:
$ heroku git:remote -a YourAppName
现在,您可以安全地部署您的应用:
$ git push heroku master
您应该等待一段时间,看看在部署时是否在控制台上没有出现任何错误/中断。有关详细信息,请查看heroku article。
可能值得检查.git文件夹中的配置文件。如果heroku参数丢失,那么你将得到这个错误heroku param
[remote "heroku"]
url = [email protected]:`[Your heroku app].git
fetch = +refs/heads/*:refs/remotes/heroku/*
.git文件夹应位于您在heroku中创建的应用程序的本地计算机文件目录中。例如C:\ Users \ You \ Your app.git
希望这可以帮助
我的问题是我使用git(而不是heroku git)来克隆应用程序。然后我不得不:
git remote add heroku [email protected]:MyApp.git
请记住将MyApp更改为您的应用名称。
然后我可以继续:
git push heroku master
对我来说,答案是在运行heroku create
或git push heroku master
之前进入应用程序的根目录
如果弹出此错误,则因为没有名为Heroku的远程。当你做一个Heroku创建时,如果git遥控器还不存在,我们会自动创建一个(假设你在一个git repo中)。要查看您的遥控器类型:
“git remote -v
”。 #对于名为“appname”的应用,您将看到以下内容:
$ git remote -v
heroku [email protected]:appname.git (fetch)
heroku [email protected]:appname.git (push)
如果你看到你的应用程序的遥控器,你可以只“git push master
”并替换为实际的远程名称。
如果缺少,则可以使用以下命令添加远程:
git remote add heroku [email protected]:appname.git
如果你已经添加了一个名为Heroku的遥控器,你可能会收到如下错误:
fatal: remote heroku already exists.
所以,然后删除现有的遥控器,并使用上面的命令再次添加它:
git remote rm heroku
希望这可以帮助…