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.

please help me I am still a beginner, and trying to find tutorials related to this problem is still very minimal

my question: is there a way to connect hugo with tinacms but can also connect with github and cloudflare pages which in the end I can publish static web hugo with a subdomain address provided by cloudflare pages or github.

I also face the same issue still do not know how can I keep repo private and deploy. maybe let GitHub generate the Hugo site and then push the public folder to cloud service provider such as cloudflare pages