Netlify and Hugo Modules with private repo (fatal: could not read Username for 'https://github.com'

I have 2 private repos: 1 for my theme and 1 for my site. I’m calling the theme like this:

[module]
[module.hugoVersion]
[[module.imports]]
path="github.com/myusername/mytheme"

If github.com/myusername/mytheme is a public repo then I can deploy without any issues (on Netlify), but if it’s a private repo then the build fails because it cannot read username (have already given Netlify access to both repos).

I’d really appreciate help finding a solution to this… I would also be happy to deploy as Cloudflare Worker Pages if somebody knows how to do that with 2 private repos (hugo site + hugo theme module).

https://answers.netlify.com/search?q=could%20not%20read%20Username

I’ve tried using git submodules in the past and it was a disaster, so I’d like to avoid it if possible… especially because I don’t plan to make site-specific changes to the theme repo.