在Heroku上部署代码

时间:2016-06-30 14:42:34

标签: git heroku deployment bitbucket

当我尝试运行时

git push heroku master

它说错误

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

在运行此命令之前,我已将代码推送到bitbucket,因为

git remote -v

正在显示

origin  https://prashant@bitbucket.org/prashant/code.git (fetch)
origin  https://prashant@bitbucket.org/prashant/code.git (push)

如何在Bitbucket上继续我的源代码版本控制时将代码部署到heroku?

每次

时都需要更改远程原点
  • 我在Heroku上部署我的代码
  • 我将代码推送到Bitbucket

我知道这听起来没有意义,但作为初学者,这是我脑海中唯一的事情

修改 步骤顺序:

heroku login 

Git init

heroku create

git add . 

git commit -am "give some comment"

git remote add origin https://prashant@bitbucket.org/prashant/code.git

git push heroku master

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

2 个答案:

答案 0 :(得分:2)

为了将分支推送到Heroku,从而部署代码,必须将Heroku存储库配置为git项目的远程存储库。

这意味着,当您运行git remote时,您应该会看到Heroku回购。

要将回购链接添加到现有的Heroku应用程序,只需使用

即可
$ git remote add heroku "PATH_TO_THE_HEROKU_APP"

另见https://devcenter.heroku.com/articles/git#creating-a-heroku-remote

之后,您将能够通过运行

进行部署
$ git push heroku master

答案 1 :(得分:1)

Heroku和Bitbucket是两个不同的东西,虽然有些命令是相似的。试试这个将你的应用程序部署到heroku。

我假设您已经在heroku上创建了帐户。如果不是click here并制作一个。

转到您的终端,将目录更改为您的应用所在的目录,并在命令

下运行
sshpass

这将有效,请阅读此内容以获取有关git,heroku和GitHub的更多信息(GitHub类似于Bitbucket)

相关问题