草庐IT

Git push 与 git push heroku master

coder 2023-06-24 原文

我刚从笔记本电脑换到 Mac,我注意到我的 git 命令响应方式有一个奇怪的差异。

之前,我会做以下事情:

git add .
git commit -m "These are my new changes"
git push # This would update my repo on github
{enter password}
git push heroku master # This would push to my app on heroku
{enter password}

现在,当我执行 git push 时,应用程序只部署在 Heroku 上,而无需推送到我的 Github 存储库。

我如何确保更新这两个地方?

编辑

谢谢两位的回答!我很欣赏对 git pushgit push heroku master 之间的区别的澄清,因为 git push 正在 push 原点,在我的例子中,似乎是 Heroku。

如何更改设置以使其像以前一样工作?即我希望 git push 现在推送到我在 Github 上的 repo,我希望 git push heroku master 推送到 Heroku。前者目前直接推送到 Heroku,完全绕过 Github。

最佳答案

要获得您想要的行为,您需要删除现有的 Remote 并重新添加它们:

git remote show origin # copy down the heroku URL
git remote rm origin
git remote add origin [github URL]
git remote add heroku [heroku URL]

关于Git push 与 git push heroku master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4413681/

有关Git push 与 git push heroku master的更多相关文章

随机推荐