使用bitbucket上的git部署到Heroku

Was*_*uel 78 git github heroku bitbucket heroku-toolbelt

我想使用git在bitbucket上托管我的源码,因为我显然得到了一个免费的私人仓库,我想使用bitbucket的源代码在heroku上托管我的应用程序.

我可以使用github客户端和heroku工具带来完成它.它会起作用吗?Github很棒,但我不希望每个人都看到我的代码,我不想支付私人回购,因为它是一个小项目.

Xav*_*ier 61

无论您在何处托管代码,部署到Heroku都应该可以正常工作,因为Heroku CLI为了部署而添加了自己的git远程.事实上,你甚至可以git pull从Heroku,所以你可以在技术上使用Heroku作为私人git存储库(虽然不推荐).至于使用GitHub客户端连接到bitbucket,只需将存储库远程更改为客户端设置选项卡中bitbucket提供的URL.

  • 我应该在哪里更改远程网址? (4认同)

Ste*_*fan 35

只是为了补充zeiv的答案谁说它应该有效:我可以确认它确实如此.我们使用bitbucket进行git托管并部署到heroku.您似乎无法做的是将您的bitbucket repo添加到您的heroku帐户以显示提交历史记录,此功能似乎目前仅限于github(heroku的错误;-)


han*_*ole 15

和Stefan一起玩 - 这完美无缺.这是我做的:

  1. 对我的WP博客每天重置的方式感到非常沮丧,介绍任何使用设置屏幕导航到http://blog.example.com的人,因为没有wp-config.php.
  2. 登录到bitbucket.org.
  3. 链接我的bitbucket和github帐户.
  4. 我从github分发了我的"wp-blog"回购,我之前已将其链接到我的heroku远程.
  5. 克隆到这个新的fork("git clone https://myname@bitbucket.org/myname/wp-blog_config.git ").
  6. 添加了正确的wp-config.php.
  7. 在这个新的fork中添加了我的heroku远程("git remote add heroku git@heroku.com:adjective-noun noun-1234.git")
  8. 已提交并部署到heroku("git push heroku master:master")


Kar*_*ler 12

Bitbucket现在支持Pipelines,这使得它很容易在Heroku上部署.只需按照本教程:https://confluence.atlassian.com/bitbucket/deploy-to-heroku-872013667.html

bitbucket-pipelines.yml将主分支推送到Heroku看起来像这样:

image: node:6
clone:
  depth: full
pipelines:
  branches:
    master:
      - step:
          script:
            - git push -f https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git $BITBUCKET_BRANCH
Run Code Online (Sandbox Code Playgroud)

  • 这可行,但请确保使用 https://dashboard.heroku.com/account 中的 API 密钥,而不是来自 `heroku auth:token` 的 API 密钥 (3认同)