zhuweiping
V2EX  ›  问与答

本地有两个仓库 A, B 需要推送到 GitHub 上的不同账号

  •  
  •   zhuweiping · May 5, 2016 · 2657 views
    This topic created in 3739 days ago, the information mentioned may be changed or developed.

    小白第一次在 V 站提问,有不当的地方请大家多多指教!疑问:本地有两个仓库 A , B 需要推送到 GitHub 上的不同账号,于是想当然的在 A/.git 目录下建一个.git-credentials-A,用于 store 仓库 A 在 GitHub 上对应账号和密码,在 B/.git 目录下建一个.git-credentials-B,用于 store 仓库 B 在 GitHub 上对应账号和密码,分别在 A 目录和 B 目录执行 git config --local credential.helper store --file ~/A/.git/.git-credentials-A 和 git config --local credential.helper store --file ~/B/.git/.git-credentials-B,结果是给出了 git config [选项]的用法提示...命令没有被执行....求问这样做的思路是不是正确?看到前辈的帖子里有 git config --global credential.helper store --file ~/A/.git/.git-credentials-A 这样的命令,请问怎么样才能让它成功执行?

    4 replies    2016-05-05 12:28:33 +08:00
    domty
        1
    domty  
       May 5, 2016
    倒是可以通过在 ssh 文件夹下设置 config 文件根据不同的 git host 地址选择不同的 rsa key 进行推送。

    如果都在 github 上的话,为啥不让 a 账号 fork b 账号的项目,完成后再 pull request ?
    zmj1316
        2
    zmj1316  
       May 5, 2016
    我直接保存密码到全局, push 到哪个就用哪个的账号密码
    zhuweiping
        3
    zhuweiping  
    OP
       May 5, 2016
    @domty 嗯, ssh 试过可以!在 GitHub 上那个方法是个新思路哈,感谢!
    zhuweiping
        4
    zhuweiping  
    OP
       May 5, 2016
    @zmj1316 我试试,感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:43 · PVG 02:43 · LAX 11:43 · JFK 14:43
    ♥ Do have faith in what you're doing.