I recently created a second GitHub account two separate my work and my private projects (before, I only had the work account). I use https in combination with the Windows cr
I just setup a mutli-credential setup for my Jenkins that might be applicable to what you're doing.
For our Jenkins user, we're pushing our configuration to AWS CodeCommit to backup the server. We also need the ability to use the mvn release plugin which requires the ability to push to our Github repo. Our jenkins instance is also in a subnet that prevents outgoing SSH so we have to use HTTPS.
Thus, we need two sets credentials. It should also be noted that our Github organizaiton requires MFA so the password is actually the personal access token.
# /var/lib/jenkins/.gitconfig
[user]
name = Jenkins
email = jenkins@domain.io
[credential]
helper = !aws --profile default codecommit credential-helper $@
UseHttpPath = true
[credential "https://github.com"]
helper = store
# /var/lib/jenkins/.git-credentials
https://username:password@github.com/SomeOrg/some-repo
One additional point is that since it seems both your repos/organizations are on Github, here are some additional points from the git documentation that might be applicable to you:
useHttpPath - By default, Git does not consider the "path" component of an http URL to be worth matching via external helpers. This means that a credential stored for https://example.com/foo.git will also be used for https://example.com/bar.git. If you do want to distinguish these cases, set this option to true.
https://git-scm.com/docs/gitcredentials