Daily Archives: July 22, 2019

vim-plug: git error “could not read Username for…”

When I tried to PlugInstall a new plugin called ‘talek/vorax4’, which is an old SQL*Plus IDE, git kept on returning with the following error:

x vorax4:
    Cloning into '/home/skan/.vim/plugged/vorax4'...
    fatal: could not read Username for 'https://github.com': terminal prompts disabled

Here’s the screen shot:

I had the following line in my ~/.vimrc.

Plug 'talek/vorax4.git'

Then my Google search yielded this helpful page, and it explains that this is caused by the system trying to authenticate with https with an account that has 2FA enabled.

This can be solved by forcing git to use ssh for all interactions.

Jaco Pretorius

And following the instructions there, I executed the following line:

$ git config --global --add url."git@github.com:".insteadOf "https://github.com/"

Above command adds the following lines to ~/.gitconfig.

[url "git@github.com:"]
    insteadOf = https://github.com/

However, I was getting a different error this time:

ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

I went back to into ~/.vimrc and removed that .git extension from the plugin name, so it reads:

Plug 'talek/vorax4'

Success!

Then, after all these, I realized I could have just removed .git from the repo name without adding that line to ~/.gitconfig. 😉