---
# System prepended metadata

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

---

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

Ops. `https://github.com': terminal prompts disabled`

If you see this message, there is a short solution how to fix it here. In my case it appeared after I updated Golang to
the version 15.2 and it did not want to get fixed by many ways that are offered on the internet.

Some of them that did not work:
1. Set `git config --global --add credential.helper manager`
2. To add GIT_TERMINAL_PROMPT=1 to the enviroments.
3. Use HTTPS authentification instead of SSH
4. etc.

Only one solution worked well for me. To use a key pair.

step 1. Create a key pair. Fallowing the description on the page https://docs.github.com/ee/ssh/, just add the public key
to your SSH setting on github.com, put your private key to .ssh folder (in my case it was id_rsa file) and check if it
works by `ssh -T git@github.com` command.

It is really right way to have access to your repository using a private key.

step 2. Point out that your repository or even repositories are private to Golang.
Set `go env -w GOPRIVATE="github.com/bloXroute-Labs*"`.

step 3. Set `git config --global url."git@github.com:".insteadOf "https://github.com/"`. This will make Git use our private key in ~.ssh directory.

After the key is used, all the private packages are pulled and pushed without any trouble.


# How to use work ssh key for a private repository

Ensure that both your work and personal SSH keys are added to the SSH agent by running the following commands in your terminal:

```
ssh-add ~/.ssh/work_key
ssh-add ~/.ssh/personal_key
```

Replace ~/.ssh/work_key and ~/.ssh/personal_key with the paths to your work and personal SSH key files, respectively.

Verify that the SSH keys are added to the agent by running:

```

ssh-add -l
```

This command will list all the keys added to the agent.

Change the remote URL of your cloned repository to use the SSH URL associated with your work account. In your terminal, navigate to the repository's directory and run the following command:

```
git remote set-url origin git@github.com:your-username/your-repo.git
```
Replace your-username and your-repo with your actual GitHub username and the repository name, respectively.

Make sure that your Git configuration is set to use the SSH protocol for remote operations. Run the following command in your terminal:

```
git config remote.origin.url
```
This command should display the SSH URL you set in the previous step.

Now, when you push your code, the SSH agent will automatically use the appropriate key. Run the following command to push your changes:

```
git push
```
The SSH agent will select the correct key based on the remote URL you specified.

By following these steps, you can ensure that your work SSH key is used when pushing code to your GitHub repository, even if you initially cloned the repository using your personal key.


## Note
For while commiting the changes, Set the global Git configuration for your work name and email by running the following commands:
```
git config --global user.name "Your Work Name"
git config --global user.email "yourworkemail@example.com"
```
Verify that the Git configuration has been set correctly by running the following command:

`git config --global --list`

![](https://hackmd.io/_uploads/HJHifXwL3.png)
