Git配置:一个提取和两个推送目的地

时间:2015-01-06 02:26:08

标签: git heroku egit

我在Eclipse中使用EGit进行版本控制。我想要两个远程Git存储库,一个是Github,另一个是Heroku。前者用于系统开发团队,后者仅用于部署。我按如下方式设置了git config文件,但它对两个遥控器都不起作用。

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "github"]
    url = https://github.com/yltang52/airbus.git
    fetch = refs/heads/master:refs/remotes/origin/master
    push = master:refs/heads/master
[remote "heroku"]
    url = https://git.heroku.com/airbus.git
    push = master:refs/heads/master
[branch "master"]
    remote = github
    merge = refs/heads/master

PS。 yltang52是github用户名,airbus是项目名称。

其中一个问题是Git建议将.git目录放在项目根目录之外,这就是我现在正在做的事情。但是,Heroku需要将目录放在项目根目录中。

当我在项目根目录中创建.git目录时(根据Heroku的部署过程),我可以将项目部署到Heroku。但是当我尝试提交并推送到Github时,我的所有文件都被标记为提交。显然,这两个.git副本不能一起工作。

我想将Heroku部署集成到EGit中。任何解决方案?

1 个答案:

答案 0 :(得分:2)

直接使用与Heroku兼容的Eclipse项目,然后来添加GitHub远程repo引用会更容易。

这是" How to push to multiple remote Git repositories using 1 Eclipse operation (killing 2 birds with 1 stone)"中描述的内容,使用:

这应该会给你一个heroku应用程序已经配置了heroku远程URL,你可以配置这些远程URL:

https://lh5.googleusercontent.com/s0BexPSV1e7c_BEJ3aMlKxnLx1pO7wLgixSnvRoFcuE8fw2Jl99zaY2csJbSfVRg_c3Mnq6RRWjChCsF-apW3nnk39iSrrgeIDn6RzIsXCJDCp6CqEP-PCXRPQ

您可以添加两个push url(到GitHub repo和heroku):

https://lh4.googleusercontent.com/UtOL9MAzW35ZivE2lp-OQFEacg6Jl6avPX65Q79Na8raExYZcDhTXb5kTzM1MfzRVh54_o1wSCt73VoxYxLm9xZGq5uXKtxm_A6PQu2QOUe_si7FyB8NYSCkRg

(您可以以相同的方式配置Fetch)

从那里,一个"推向上游"将推动两者:

https://lh3.googleusercontent.com/Rp1r1qmjeZjAs5ZSw0TfR426m1buWdX31SaWTwLpQdW-s5Ri5QSKMf__T1cZNZ4Uc_ImcAz_fGqhQQ0F5Xodax6BJKOqqF0iepV6LNBtvSyVlFnqA1PzJ9v21A

相关问题