sh.exe": clip: command not found

Solution 1:

clip.exe should be in C:\Windows\System32\ or C:\Windows\SysWOW64\. You can check if those folders are in your path by doing echo $PATH. If they aren't (which would surprise me), you can add them:

$ export PATH="$PATH:/c/Windows/System32:/c/Windows\SysWOW64"

It's probably more likely clip.exe doesn't exist on your system at all.

However, there's a much simpler way you can manipulate the Windows clipboard from Git Bash (or, for that matter, Cygwin): the clipboard device file, /dev/clipboard.

To write to it:

$ echo "test" >/dev/clipboard

To read from it:

$ cat </dev/clipboard

The equivalent of your command would be:

$ cat ~/.ssh/id_rsa.pub >/dev/clipboard

Solution 2:

This is an old question, but for what it's worth...

I'm running Windows 10 with WSL 2 all configured and I found that clip.exe is present on my system at C:\Windows\System32\ and my path does already include C:\Windows\System32\. All I needed to do was to add .exe to the command in this obvious (to me, anyway) location:

clip.exe < ~/.ssh/id_rsa.pub