V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zhuweiping
V2EX  ›  问与答

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

  •  
  •   zhuweiping · 2016-05-05 09:47:29 +08:00 · 1942 次点击
    这是一个创建于 2935 天前的主题,其中的信息可能已经有所发展或是发生改变。

    小白第一次在 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 条回复    2016-05-05 12:28:33 +08:00
    domty
        1
    domty  
       2016-05-05 09:54:35 +08:00
    倒是可以通过在 ssh 文件夹下设置 config 文件根据不同的 git host 地址选择不同的 rsa key 进行推送。

    如果都在 github 上的话,为啥不让 a 账号 fork b 账号的项目,完成后再 pull request ?
    zmj1316
        2
    zmj1316  
       2016-05-05 10:31:30 +08:00
    我直接保存密码到全局, push 到哪个就用哪个的账号密码
    zhuweiping
        3
    zhuweiping  
    OP
       2016-05-05 12:27:50 +08:00
    @domty 嗯, ssh 试过可以!在 GitHub 上那个方法是个新思路哈,感谢!
    zhuweiping
        4
    zhuweiping  
    OP
       2016-05-05 12:28:33 +08:00
    @zmj1316 我试试,感谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2518 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 03:30 · PVG 11:30 · LAX 20:30 · JFK 23:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.