krewfile icon indicating copy to clipboard operation
krewfile copied to clipboard

SSH not available during krew activation

Open nesmanriquecelonis opened this issue 6 months ago • 1 comments

Hello, this is probably some noob nix error from my part but what would be the right way to debug this problem? It seems like ssh (and maybe git?) are not available during activation time for krew and the whole process fails.

Activating krew
reading krewfile
getting installed indexes
updating krew
an error occurred: krew error:
WARNING: To be able to run kubectl plugins, you need to add
the following to your ~/.zshrc:

    export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

and restart your shell.

W0701 01:58:45.262328    3969 update.go:168] failed to update index "default": fetch index at "/Users/n.manriquecruz/.krew/index/default" failed: command execution failure, output="error: cannot run ssh: No such file or directory\nfatal: unable to fork\n": exit status 128
failed to update the following indexes: default: fetch index at "/Users/n.manriquecruz/.krew/index/default" failed: command execution failure, output="error: cannot run ssh: No such file or directory\nfatal: unable to fork\n": exit status 128

I tried changing the default index like so to try to force it to use https instead but it didn't really help.

   krewfile = {
     enable = true;
     krewPackage = pkgs.krew;
     indexes = {
       default = "https://github.com/kubernetes-sigs/krew-index.git";
     };
     plugins = [
       ...
     ];
   };

nesmanriquecelonis avatar Jul 01 '25 00:07 nesmanriquecelonis

Hi there, so I wasn't able to reproduce that in docker:

docker run -it --rm nixery.dev/shell/bash/krew krew index list && krew update

The default index should be fetched over https by default. Do you happen to have along the lines of

"ssh://[email protected]" = {insteadOf = "https://github.com";};

in your config? That would explain why it requires ssh.

brumhard avatar Jul 07 '25 09:07 brumhard