【问题标题】:How can I use Git with multiple remote repositories?如何将 Git 与多个远程存储库一起使用?
【发布时间】:2011-03-17 16:59:07
【问题描述】:

我目前使用 Heroku 进行 Rails 托管,它使用 Git 存储库进行部署。我还有一个托管的 Git 存储库,用作历史/备份目的的主要源代码控制。我希望有 1 个本地文件夹,其中包含我的应用程序的工作副本,然后能够在需要时将我的更改提交到 Heroku 存储库或我的托管存储库。

我该怎么做? (请注意,我熟悉 Team System 如何进行源代码控制,并且对 Git 非常陌生)

【问题讨论】:

    标签: git heroku


    【解决方案1】:

    将它们都添加为遥控器:

    git remote add origin ssh://myserver.example.com/var/git/myapp.git
    git remote add hosted ssh://myotherserver.example.com/var/git/myapp.git
    

    [1]http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository

    [2]http://www.kernel.org/pub/software/scm/git/docs/git-remote.html

    【讨论】:

    • 将它们都称为起源并不是一个好主意。我更喜欢根据托管 repo 的服务器或服务来命名遥控器。
    • 我认为您可能需要为每个遥控器指定不同的名称,而不是“原点”。例如,将第一个称为“origin”,将第二个称为“hosted”。
    猜你喜欢
    • 2013-01-04
    • 1970-01-01
    • 2018-04-01
    • 1970-01-01
    • 2013-09-19
    • 2011-09-16
    • 2021-03-09
    • 1970-01-01
    相关资源
    最近更新 更多