为什么这个git没有正确推送到Heroku? [英] Why this git is not pushed properly to Heroku?
问题描述
我的本地机器上有一个文件夹(我们称之为 Code1
),它包含一个php脚本,一个README文件和composer.json文件。我已经在Heroku上创建了一个应用程序(让我们称它为 App1
)。
现在我想创建一个新的应用程序,并修改相同的文件夹。
因此,我复制并粘贴了文件夹(让我们称之为新文件夹 Code2
)在我的本地机器中。
然后我做了以下事情:
$ b
- 在终端登录Heroku
- 通过输入
cd Code2
进入文件夹目录 - 输入
heroku create
(a新应用程序已创建 - 我们称之为App2
) - 输入
git push heroku master $ c $在这之后得到的输出是:
一切都是最新的$ c $>
- Logged in Heroku at the terminal
- Entered the folder directory by entering
cd Code2
- Entered
heroku create
(a new app was created - let's call itApp2
) - Entered
git push heroku master
$ b
c>
其实质上是指 如何通过推送我的新文件夹( App1
,并且它不会部署 App2 code $。
)到它?
App2
> Code2
Code1
目录复制到 Code2
,你很可能复制了中的 .git
目录>代码1
。在文件 .git / config
内将是heroku远程定义: [remoteheroku]
url = https://git.heroku.com/App1.git
fetch = + refs / heads / *:refs / remotes / heroku / *
由于该远程定义指向 App1
,所以 git push heroku master
推送。
更新heroku git remote到新应用程序的一种方法是运行以下命令,而你在 Code2
目录中:
heroku git:remote -a App2
I have a folder (let's call it Code1
) on my local machine which contains a php script, a README file and composer.json . I have created an app (let's call it App1
) on Heroku by pushing this file to it.
Now I want to create a new app with the same folder slightly modified.
For this reason, I copied and pasted the folder (let's call the new folder Code2
) in my local machine.
Then I did the following things:
The output I get after this is: Everything up-to-date
which essentially refers to App1
and it does not then deploy App2
.
How can I deploy App2
by pushing my new folder (Code2
) to it?
When you copied the Code1
directory to Code2
, you most likely copied the .git
directory in Code1
. Inside the file .git/config
will be the heroku remote definition:
[remote "heroku"]
url = https://git.heroku.com/App1.git
fetch = +refs/heads/*:refs/remotes/heroku/*
Since that remote definition points to App1
, that's where git push heroku master
pushes.
One way to update the heroku git remote to the new app would be to run the following command while you are in the Code2
directory:
heroku git:remote -a App2
这篇关于为什么这个git没有正确推送到Heroku?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!