Maybe this can help ? stackoverflow - Fatal: could not read username for 'https //github.com' device not configured
I know that's not exactly what you asked but as advised in the post I'd recommend switching to ssh if possible, this is less pain to maintain.
To help you reproduce, if the issue is due to Jenkins running it not as a tty, maybe you should try executing your code locally but inside a non-interactive script.