Same domain, multiple git accounts without ssh

229 views Asked by At

I've tried to look for a way to match on a path using git config. I've only found (and tested) some mentioned in the link here, among others. Multiple git accounts: no .ssh/config or SSH agent usage

I have also read through https://git-scm.com/docs/gitcredentials but either didn't understand how to use these wildcards or they just didn't work as I thought they would. I currently have this setup:

[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 = [email protected]
[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 = [email protected]
    # useHttpPath = true
    helper = wincred

Using ssh for them worked fine, but I remember it can be an issue when behind a firewall and such.

It'd be nice if I could just match on the path of git and have it group all paths that match with it to use the same credentials. But perhaps I'm not seeing the issue with that. And if I'm doing something wrong, please tell me!

Thank you kindly in advance.

0

There are 0 answers