'Receiving fatal: could not read Username for 'https://github.com': terminal prompts disabled while building project in terminal

I have started working on Golang project. While building with make, I am getting following error:

fatal: could not read Username for 'https://github.com': terminal prompts disabled

To handle this, I have done following after going through similar post go get results in 'terminal prompts disabled' error for github private repo :

export GIT_TERMINAL_PROMPT=1

But this did not solve the problem, now it seems to be asking username and password in infinite loop.

My git config is as follows:

$git config --list

[email protected]:GolangProjects/Project1.git

Even after this config, why it keeps on using https instead of SSH, not getting any clue. Please help.

git


Solution 1:[1]

Had the same issue with git fetch:

https://github.com/andry81-devops/github-accum-stats/runs/4429723185?check_suite_focus=true#step:2:169

Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/master*:refs/remotes/origin/master* +refs/tags/master*:refs/tags/master*
  Error: fatal: could not read Username for 'https://github.com': terminal prompts disabled
  The process '/usr/bin/git' failed with exit code 128
  Waiting 14 seconds before trying again

To fix that you have to update the repo secrets token.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1