V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
DIJ
V2EX  ›  git

git remote 中同时有 heroku 和 origin (github) ,如何 git commit 到 github (目前自动 commit 到 heroku )?

  •  
  •   DIJ · 2015-06-06 09:11:28 +08:00 · 3869 次点击
    这是一个创建于 3246 天前的主题,其中的信息可能已经有所发展或是发生改变。
    8 条回复    2015-06-07 18:00:25 +08:00
    foccy
        1
    foccy  
       2015-06-06 09:34:47 +08:00
    git push origin branch 这样?

    可以 google 一下。
    likaci
        2
    likaci  
       2015-06-06 09:43:29 +08:00
    @foccy git push -u origin master 加个-u
    --set-upstream
    jokester
        3
    jokester  
       2015-06-06 09:48:54 +08:00   ❤️ 1
    先学会提问题
    你不**commit**到远程repo
    你**push**到远程repo
    zts1993
        4
    zts1993  
       2015-06-06 11:22:54 +08:00 via Android
    commit只要一次吧,应该是push两次,要不写个脚本。。。。
    gowithwind
        5
    gowithwind  
       2015-06-06 14:16:56 +08:00
    帮你搜了下

    git remote set-url origin --push --add user1@repo1
    git remote set-url origin --push --add user2@repo2
    git remote -v show
    roychan
        6
    roychan  
       2015-06-06 14:23:22 +08:00
    git push origin master (branch)
    julyclyde
        7
    julyclyde  
       2015-06-07 12:17:36 +08:00
    @zts1993 push两次应该是同一个行为啊,理论上不会第一次push一个remote,第二次push另一个,除非加参数。而lz问的就是:加什么参数
    eastphoton
        8
    eastphoton  
       2015-06-07 18:00:25 +08:00
    commit 只需要一次提交到本地git仓库,你需要的是分别push到两家
    git commit -m "can you Google before ask?"
    git push origin master
    git push heroku master
    (master是branch名,如果不同自行修改)

    如果你需要只输入git push就提交到heroku而不指定remote仓库名称,那么执行一次
    git branch --set-upstream=heroku


    提问之前请先搜索一下,这种简单问题最好不要浪费他人时间
    http://www.beiww.com/doc/oss/smart-questions.html
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   991 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:52 · PVG 04:52 · LAX 13:52 · JFK 16:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.