【问题标题】:Github and Heroku terminal confusion (osX)Github 和 Heroku 终端混淆 (osX)
【发布时间】:2016-12-16 06:41:05
【问题描述】:

我在 Heroku 上有一个节点服务器及其 git 终端扩展。如何分别使用两个存储库?我在 github 上有一个 repo,我想将它用于不同的项目,但我无法切换推送目的地,这一切都交给了 heroku master。

如何更改分支?我已经尝试了几种设置 git origin 分支并尝试直接推送到它的方法,但它仍然显示了一个 heroku master。

screenshots removed for privacy, see resolution details in comments

【问题讨论】:

    标签: git macos heroku github


    【解决方案1】:

    您可以change the remote tracking branch of your current branch 使用:

    git branch branch_name -u your_new_remote/branch_name
    

    在你的情况下:

    git branch master -u origin/master
    

    这将使git statusgit push 考虑远程origin 而不是heroku

    其他解决方案是可能的:

    git config branch.master.remote origin
    

    这假设起源确实存在。
    如果没有(参见git remote -v 输出),您可以声明新的目的地:

    git remote add origin /new/destination/url
    

    如果您想完全替换现有的原点设置(用于推拉):

    git remote set-url origin /new/destination/url
    

    如果你只想要推送网址

    git remote set-url --push origin /new/destination/url
    

    见“Change the remote URL to your repository”。

    【讨论】:

    • 感谢您的回复!请查看原帖中的新截图。
    • @Micard 我已经为您编辑了我的答案以声明远程来源。
    • 请看另一张截图:)
    • 在推动之前需要再次从 Heroku 中拉出,但现在一切都好!谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-04
    • 1970-01-01
    • 1970-01-01
    • 2018-11-15
    • 1970-01-01
    • 2014-11-30
    • 2012-03-17
    相关资源
    最近更新 更多