Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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.

like image 563
Joy Avatar asked Jan 18 '20 03:01

Joy


1 Answers

Create an SSH key instead and use it as a default login method for you git repo. You can follow this link to create an ssh key for authentication on your machine:

Generating a new SSH key and adding it to the ssh-agent

And then use this to default your login method to use ssh keys instead of your credentials:

git config --global url.ssh://[email protected]/.insteadOf https://github.com/
like image 121
Himanshu Avatar answered Oct 10 '22 23:10

Himanshu