gpt4 book ai didi

git - 如何为不同的 git Remote 指定多个 user.name 和 user.email?

转载 作者:行者123 更新时间:2023-12-03 14:44:34 24 4
gpt4 key购买 nike

我的本地机器上有一个存储库。这个存储库有 2 个 git Remote 。 Remote A 和 B。

  • 远程 一个 需要 user.name X user.email .
  • 远程 需要 user.name Z user.email W .

  • 这可以在git中实现吗?如果是这样,如何?

    最佳答案

    使用 Git 2.13,您现在拥有 conditional include for git config ,但它仅基于存储库的文件系统路径。

    所以你仍然需要同一个 repo 的两个不同副本。你可以做到with git worktree (一个克隆,多个工作树)

    然后,您可以修改全局配置规范,以根据当前文件夹包含具有一组特定 user.name/user.email 的本地配置。
    见“Using different Git emails”来自 pltvs ( Alex Pliutau )

    关于git - 如何为不同的 git Remote 指定多个 user.name 和 user.email?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45092873/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com