-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Fetching a repo over SSH fails on Windows because it fails to find the home directory. This can happen when launching from Windows Powershell, Cmd, or other environments that do not set HOME.
Reproduction steps
Fetch an SSH repo from github.com using Windows Powershell or Cmd.
Expected behavior
libgit2 should be able to find the user's home directory. There are multiple ways to do that, though I'm not sure of the benefits of different approaches. Checking for USERPROFILE would probably be the easiest. The Powershell port of OpenSSH uses ProfileImagePath in the registry, falling back to GetWindowsDirectoryW if that fails. (Another option is SHGetFolderPathW, though I'm not sure I would recommend that.)
Also, I think a failure to load or process the known_hosts should not be a hard error if the user has also defined their own certificate_check_cb callback. That is, the code here shouldn't be a hard error.
Actual behavior
The error is:
invalid or unknown remote ssh hostkey
Version of libgit2 (release number or SHA1)
1.5.1
Operating system(s) tested
Windows 10 Pro