It should not work this way and this is likely a bug. Especially the prompt when accessing localhost. Probably the best way to find out the exact reason is to contact support.
Possible reasons for not using saved GitHub account are using different URL in the project remote, or just the disabled saving of secrets in the IDE.
The credential prompts for localhost access is not clear. This is the call to local oath handler deployed by the IDE itself, and typically should not need any input from the user.
Git is working on the CLI because it likely uses credential-helper, which is not used in the IDE by default. You can enable it in Settings | Version Control | Git -> Use credential helper.
Note that with credential helper in use the account configured in the IDE is not used and git authenticates with whatever is saved in the helper.