Git: Host key verification failed on bootstrap -
What's wrong
I have an almost-fresh install of Linux Mint running emacs 28.2 from snap. The bootstap, pasted into an empty .emacs file failed. It failed in a novel way, producing an unactionable error message. I resolved the issue, but am sharing my issue and steps here to help other people, and possibly to help the maintainer provide troubleshooting guidance or a better error message!
After pasting the bootstrap into my empty dotfile and restarting, I received an error message in the debugger about bootstrap failing to load, and a stack trace.
Perplexed, I searched around and found that url-retrieve-synchronously was successfully downloading /tmp/straight.el-<someid>. I manually loaded one of these files and did an eval-buffer, which resulted in a *straight-process* buffer appearing, showing errors.
Note that running the bootstrap did not result in a *straight-process* buffer appearing, so this step was necessary.
I found this line:
Cloning into '/home/user/.emacs.d/straight/repos/straight.el'... ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory Host key verification failed. fatal: Could not read from remote repository.
Wait, an https request requires host key verification?
Then, I remembered I have this line in my ~/.gitconfig:
url."[email protected]:".insteadOf "https://github.com/"
This forces ssh instead of https. And I hadn't verified the host key in an interactive session yet -- note I said that this was a new install.
Easy workaround -- I removed it from my gitconfig.
Sadly, even if you use https with git, a percentage of your users is going to override that, and as a bootstrapping tool, silent failure is going to result in roughness.
Thanks for straight.el and hopefully this helps.
Yes, this is not ideal. See https://github.com/radian-software/straight.el/issues/334. We may be able to override the user's Git configuration here, but it's also not necessarily desirable to do so, since they may have set it for a reason (e.g.: they have configured a graphical program for their ssh-askpass).