-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Cannot parse Git version string #1793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is really little information to go on. I only saw something like this when |
👋 Hi @dscho. I wasn't quite at the point of reaching out to you on this but I've encountered this same issue with a handful of GitHub Desktop users in terms of Git LFS not being able to read any output from The investigation so far is happening in desktop/desktop#5247 but I'll try and summarize it here:
Things I've tried to eliminate as the root cause:
Any other thoughts or things to eliminate would be greatly appreciated. |
That is indeed strange.
Wait, what? |
Some other program that just happened to be named |
Just had word that Carbon Black is to blame and they're rolling out an update to fix this: desktop/desktop#5247 (comment) @whotired can you confirm whether you have Carbon Black installed? |
Perhaps something like GetFileVersionInfoExW would be safer? |
@whoisj safer for whom? |
@shiftkey Yes, Carbon Black has been installed on 2018-8-12 on my machine. But my colleague has same program and no this error "Cannot parse Git version string", he can open git-gui correctly. |
@shiftkey Thanks |
@shiftkey my point was instead of running an external process, which could be intercepted by interventionist services like Carbon Black, it could be safer to just use the OS provided API to query the version information. Example (written too quickly, it's a mess but you get the idea): #include "pch.h"
#include <iostream>
#include <Windows.h>
#pragma comment(lib, "mincore.lib")
static const wchar_t *path_to_git = L"C:\\Program Files\\Git\\cmd\\git.exe";
static const wchar_t *prodver_format = L"\\StringFileInfo\\%04hX%04hX\\ProductVersion";
static const wchar_t *vfi_trans_format = L"\\VarFileInfo\\Translation";
int main()
{
struct file_version_info {
void *data;
unsigned int size;
} culture, details, version;
struct culture_info {
unsigned short language;
unsigned short codepage;
} *info;
wchar_t query_string[256];
unsigned long ret;
version.size = GetFileVersionInfoSizeExW(FILE_VER_GET_NEUTRAL, path_to_git, &ret);
if (version.size <= 0)
goto failure;
ret = 0;
version.data = malloc(version.size);
if (!GetFileVersionInfoExW(FILE_VER_GET_NEUTRAL, path_to_git, 0, version.size, version.data))
goto failure;
if (!VerQueryValueW(version.data, vfi_trans_format, &culture.data, &culture.size))
goto failure;
for (int i = 0; i < (culture.size / sizeof(culture_info)); i += 1)
{
info = &((culture_info *)culture.data)[i];
query_string[wsprintfW(query_string, prodver_format, info->language, info->codepage)] = 0;
if (!VerQueryValueW(version.data, query_string, &details.data, &details.size))
continue;
wprintf(L"%s", (wchar_t*)details.data);
goto clean_up;
}
failure:
ret = GetLastError();
if (ret > 0)
wprintf(L"fata: error 0x%04h.\n", ret);
wprintf(L"Unable to read version information from \"%s\".\n", path_to_git);
clean_up:
if (version.data)
free(version.data);
return ret;
} The output is "2.18.0.windows.1". |
@whoisj no problem. It's just that for |
I guess it's not only that. While the version check would be helped by |
I'm going to close this out because I don't believe there's anything we can do in Desktop to address this, and it seems like updates to products like Carbon Black should resolve the issue eventually. (See also desktop/desktop#5247 (comment)) |
I install git 2.18.0 and 64 bit for Windows 7. While clicking "Gig GUI here" and getting error:

git-gui:fatal error
Cannot parse Git version string
The path in environment virable is "C:\Program Files\Git\cmd" as default.
The text was updated successfully, but these errors were encountered: