junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.7k stars 1.9k forks source link

Mistyping a plugin name gives a cryptic error #1273

Closed adamyakes closed 4 weeks ago

adamyakes commented 4 months ago

I recently mistyped the name of a repo/plugin, and when I ran :PlugInstall, I ran into the same cryptic error described in this Stack Overflow issue.

Cloning into 'C:\Users\myusername\AppData\Local\nvim-data\plugged\coc.vim'...
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/neoclide/coc.vim.git/'

Here's my init.lua:

local vim = vim
local Plug = vim.fn['plug#']

vim.call('plug#begin')

Plug('neoclide/coc.vim', { ['branch'] = 'release'})

vim.call('plug#end')

Note, it's supposed to be neoclide/coc.nvim. What's confusing to me is that if I run a regular git clone on with that URL, I get a much more helpful error message:

$ git clone https://github.com/neoclide/coc.vim
Cloning into 'coc.vim'...
remote: Repository not found.
fatal: repository 'https://github.com/neoclide/coc.vim/' not found

Whatever vim-plug does to fetch that repository is producing this different error message. It would be great if vim-plug would either produce the default repository not found error, or otherwise detect the scenario of a plugin not found and report as such.

junegunn commented 4 months ago

See my previous answer on that matter: https://github.com/junegunn/vim-plug/issues/465

$ git clone https://github.com/neoclide/coc.vim Cloning into 'coc.vim'... remote: Repository not found. fatal: repository 'https://github.com/neoclide/coc.vim/' not found

Interesting. I'm prompted for authentication information when I do it.

$ git clone https://github.com/neoclide/coc.vim
Cloning into 'coc.vim'...
Username for 'https://github.com': ^C

Unless I set GIT_TERMINAL_PROMPT to 0. It's what vim-plug does to avoid the prompt.


$ GIT_TERMINAL_PROMPT=0 git clone https://github.com/neoclide/coc.vim
Cloning into 'coc.vim'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
$
junegunn commented 4 months ago

Related: