如何更新使用 GitHub "Deploy to Heroku" 按钮创建的 Heroku 应用程序?
How to update an Heroku App created using GitHub "Deploy to Heroku" button?
我使用 GitHub 'Deploy to Heroku' 按钮创建了一个应用程序。由于 git 项目已更改,如何使用新的上游提交更新我现有的实例?
假设您的本地分支机构名为 master
您可以尝试:
git pull heroku master
请记住,如果您的本地分支和远程分支不同,您可能会遇到合并冲突。这还假设您已将 heroku
配置为指向存储库中的适当位置。
我去抓取原始存储库,然后强制将其推送到我在 Heroku 中的应用程序。看起来像这样:
git clone https://github.com/USER/REPO.git
git checkout v0.7.3
git remote add heroku https://git.heroku.com/APP-NAME.git
git push -f heroku master
Heroku 使用
可以轻松地为您的应用克隆存储库
heroku git:clone -a app-name
我最初尝试这样做,然后将原始存储库添加为远程并合并更改,但我 运行 遇到了一些我不想弄清楚的麻烦。
如果您已经克隆了应用程序,或者如果您想先从 Heroku 克隆应用程序,可以使用以下方法。
# Clone app if you haven't already
heroku git:clone -a appname
# Get latest app
git remote add REPO https://github.com/USER/REPO.git
git branch -b REPO REPO/master
# Delete master
git branch -D master
# Remake it with latest
git checkout -b master
# And force push it to heroku
git push -f heroku master
Heroku 的网络控制台也可以轻松做到这一点。将您的应用程序连接到 GitHub 存储库以从 selected git 分支自动或手动部署。自动部署也可以等到 CI 通过。使用以下步骤配置您的项目。
设置
- 转到应用配置页面中的以下部分
Deploy
- 对于
Deployment method
,点击GitHub
- 对于
App connected to GitHub
、select 并连接您的存储库
自动部署
- 转到应用程序配置页面中的以下部分
Deploy
> Automatic deploys
- Verify/select你想要的分支
- 可选择单击
Wait for CI to pass before deploy
- 点击
Enable Automatic Deploys
手动部署
- 转到应用程序配置页面中的以下部分
Deploy
> Manual deploys
- Verify/select你想要的分支
- 点击
Deploy Branch
截图
这是显示 UI:
的屏幕截图
Note: as mentioned by Tim Malone, this only works with your own repos, but this can be addressed by creating a fork as mentioned by Skyost.
我使用 GitHub 'Deploy to Heroku' 按钮创建了一个应用程序。由于 git 项目已更改,如何使用新的上游提交更新我现有的实例?
假设您的本地分支机构名为 master
您可以尝试:
git pull heroku master
请记住,如果您的本地分支和远程分支不同,您可能会遇到合并冲突。这还假设您已将 heroku
配置为指向存储库中的适当位置。
我去抓取原始存储库,然后强制将其推送到我在 Heroku 中的应用程序。看起来像这样:
git clone https://github.com/USER/REPO.git
git checkout v0.7.3
git remote add heroku https://git.heroku.com/APP-NAME.git
git push -f heroku master
Heroku 使用
可以轻松地为您的应用克隆存储库heroku git:clone -a app-name
我最初尝试这样做,然后将原始存储库添加为远程并合并更改,但我 运行 遇到了一些我不想弄清楚的麻烦。
如果您已经克隆了应用程序,或者如果您想先从 Heroku 克隆应用程序,可以使用以下方法。
# Clone app if you haven't already
heroku git:clone -a appname
# Get latest app
git remote add REPO https://github.com/USER/REPO.git
git branch -b REPO REPO/master
# Delete master
git branch -D master
# Remake it with latest
git checkout -b master
# And force push it to heroku
git push -f heroku master
Heroku 的网络控制台也可以轻松做到这一点。将您的应用程序连接到 GitHub 存储库以从 selected git 分支自动或手动部署。自动部署也可以等到 CI 通过。使用以下步骤配置您的项目。
设置
- 转到应用配置页面中的以下部分
Deploy
- 对于
Deployment method
,点击GitHub
- 对于
App connected to GitHub
、select 并连接您的存储库
自动部署
- 转到应用程序配置页面中的以下部分
Deploy
>Automatic deploys
- Verify/select你想要的分支
- 可选择单击
Wait for CI to pass before deploy
- 点击
Enable Automatic Deploys
手动部署
- 转到应用程序配置页面中的以下部分
Deploy
>Manual deploys
- Verify/select你想要的分支
- 点击
Deploy Branch
截图
这是显示 UI:
的屏幕截图Note: as mentioned by Tim Malone, this only works with your own repos, but this can be addressed by creating a fork as mentioned by Skyost.