我试图寻找一种使用 git config 匹配路径的方法。我只发现(并测试了)此处链接中提到的一些内容,等等。多个 git 帐户:不使用 .ssh/config 或 SSH 代理
我也通读了https://git-scm.com/docs/gitcredentials但要么不了解如何使用这些通配符,要么它们没有像我想象的那样工作。我目前有这个设置:
[core]
editor = \"C:\\Users\\anton\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" --wait
sshCommand = C:/Windows/System32/OpenSSH/ssh.exe
[user]
name = firstuser
email = firstuser@gmail.com
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[merge "ours"]
driver = true
[credential "https://github.com/workuser/*"]
username = workuser
useHttpPath = true
helper = wincred
[credential "https://github.com/firstuser/*"]
username = firstuser
useHttpPath = true
helper = wincred
[credential "https://gitlab.com"]
username = firstuser@gmail.com
# useHttpPath = true
helper = wincred
为他们使用 ssh 效果很好,但我记得在防火墙等后面可能会出现问题。
如果我可以匹配 git 的路径并将所有与其匹配的路径分组以使用相同的凭据,那就太好了。但也许我没有看到这个问题。如果我做错了什么,请告诉我!
预先感谢您。