如何在Heroku多个应用中精准推送特定应用程序?

2026-04-10 07:041阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计442个文字,预计阅读时间需要2分钟。

如何在Heroku多个应用中精准推送特定应用程序?

使用Heroku创建新应用后,若想推送代码到test-app3,您应按照以下步骤操作:

1. 在终端中,确保您的Git仓库已经初始化并添加了远程仓库。

2.使用`git add`命令添加您要推送的代码文件。

3.使用`git commit`命令提交您的更改。

4.使用`git push`命令将您的更改推送到Heroku的远程仓库。

具体命令如下:

bash

heroku create test-app3git add .git commit -m Update code for test-app3git push heroku master

注意:如果您使用的是分支,请确保在`git push`命令中使用正确的分支名,例如`git push heroku your-branch:master`。

如何在Heroku多个应用中精准推送特定应用程序?

当您在终端输入`heroku`命令查看列表时,您会看到类似以下信息:

my-apptest-app1test-app2test-app3

这表明您的应用test-app3已成功创建并添加到Heroku列表中。

我使用heroku create test-app3创建了一个新的heroku应用程序.现在,如果我想将一些代码推送到这个新的test-app3,我该怎么做?

当我在终端输入heroku列表时,我得到:
我的应用

> test-app1
> test-app2
> test-app3

我如何推送test-app3?如何在要推送的应用程序之间切换?

您需要为Heroku中的每个应用程序设置不同的git远程端点,以便您可以从一个本地存储库推送到任一应用程序.

通过仪表板在Heroku上获取应用程序的GIT URL(它看起来与此类似:git@heroku.com:your_app_name.git)并执行:

git remote add test-app1 git@heroku.com:test-app1.git git remote add test-app2 git@heroku.com:test-app2.git git remote add test-app3 git@heroku.com:test-app3.git

然后你就可以推送到这样的任何特定应用:

git push test-app1 master git push test-app2 master git push test-app3 master

本文共计442个文字,预计阅读时间需要2分钟。

如何在Heroku多个应用中精准推送特定应用程序?

使用Heroku创建新应用后,若想推送代码到test-app3,您应按照以下步骤操作:

1. 在终端中,确保您的Git仓库已经初始化并添加了远程仓库。

2.使用`git add`命令添加您要推送的代码文件。

3.使用`git commit`命令提交您的更改。

4.使用`git push`命令将您的更改推送到Heroku的远程仓库。

具体命令如下:

bash

heroku create test-app3git add .git commit -m Update code for test-app3git push heroku master

注意:如果您使用的是分支,请确保在`git push`命令中使用正确的分支名,例如`git push heroku your-branch:master`。

如何在Heroku多个应用中精准推送特定应用程序?

当您在终端输入`heroku`命令查看列表时,您会看到类似以下信息:

my-apptest-app1test-app2test-app3

这表明您的应用test-app3已成功创建并添加到Heroku列表中。

我使用heroku create test-app3创建了一个新的heroku应用程序.现在,如果我想将一些代码推送到这个新的test-app3,我该怎么做?

当我在终端输入heroku列表时,我得到:
我的应用

> test-app1
> test-app2
> test-app3

我如何推送test-app3?如何在要推送的应用程序之间切换?

您需要为Heroku中的每个应用程序设置不同的git远程端点,以便您可以从一个本地存储库推送到任一应用程序.

通过仪表板在Heroku上获取应用程序的GIT URL(它看起来与此类似:git@heroku.com:your_app_name.git)并执行:

git remote add test-app1 git@heroku.com:test-app1.git git remote add test-app2 git@heroku.com:test-app2.git git remote add test-app3 git@heroku.com:test-app3.git

然后你就可以推送到这样的任何特定应用:

git push test-app1 master git push test-app2 master git push test-app3 master