#853·krew

krew fails to work if `defaultRemoteName` is assigned in ~/.gitconfig

Author: dustmopCreated Mar 27, 2024Updated Oct 7, 2024
Labelskind/supportlifecycle/frozen

I have this config option set in my global ~/.gitconfig file:

[clone]
	defaultRemoteName = home

Which changes the default remote name to home. However, krew assumes that the default remote name is always going to be origin, due to https://github.com/kubernetes-sigs/krew/blob/efaaa22897a069937e3017dbeb01dfeb6a6aec80/internal/gitutil/git.go#L75

This causes most commands to fail:

> kubectl krew install [PACKAGE_NAME_HERE]
failed to retrieve plugin indexes: failed to list the remote URL for index default: command execution failure, output="": exit status 1

It would be better if one of the following were true:

  1. krew would detect this setting and use the actual remote name
  2. krew did not use this setting from the global config, perhaps by running with a blank config
  3. The error message was better when GetRemoteURL returned empty data