{"record":{"id":"90cf2c02a3e168cb","repo":"LykosAI/StabilityMatrix","slug":"git-command-command-failed-with-exit-code-result-exitcode","errorCode":null,"errorMessage":"Git command [{command}] failed with exit code {result.ExitCode}:\n{result.StandardOutput}\n{result.StandardError}","messagePattern":"Git command \\[(.+?)\\] failed with exit code (.+?):\n(.+?)\n(.+?)","errorType":"exception","errorClass":"ProcessException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs","lineNumber":304,"sourceCode":"            new Dictionary<string, string>\n            {\n                { \"GIT_TERMINAL_PROMPT\", \"0\" },\n                // Set UTF-8 locale to handle Unicode characters in paths\n                { \"LC_ALL\", \"C.UTF-8\" },\n                { \"LANG\", \"C.UTF-8\" },\n            }\n        );\n        if (result.ExitCode != 0)\n        {\n            Logger.Error(\n                \"Git command [{Command}] failed with exit code \" + \"{ExitCode}:\\n{StdOut}\\n{StdErr}\",\n                command,\n                result.ExitCode,\n                result.StandardOutput,\n                result.StandardError\n            );\n\n            throw new ProcessException(\n                $\"Git command [{command}] failed with exit code\"\n                    + $\" {result.ExitCode}:\\n{result.StandardOutput}\\n{result.StandardError}\"\n            );\n        }\n    }\n\n    public async Task InstallPythonIfNecessary(IProgress<ProgressReport>? progress = null)\n    {\n        await InstallPythonIfNecessary(PyInstallationManager.DefaultVersion, progress);\n    }\n\n    public async Task InstallPythonIfNecessary(PyVersion version, IProgress<ProgressReport>? progress = null)\n    {\n        var pythonDir = GetPythonDir(version);\n\n        if (IsPythonVersionInstalled(version))\n            return;\n","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs#L286-L322","documentation":"RunGit executes a git command and, if the process exits nonzero, wraps the exit code plus stdout/stderr in a ProcessException. It is the git plumbing used by clone/pull operations during package installs and updates.","triggerScenarios":"Any git invocation via RunGit returning a nonzero exit code — clone/pull of a package repo failing due to auth, network, missing git config (e.g. safe.directory), bad URL, or disk issues.","commonSituations":"Private repo needing credentials; offline/proxy blocking github.com; git version too old; corrupted local clone causing pull failures; SSL cert problems on corporate networks.","solutions":["Read the stdout/stderr in the exception message to see the git error, then fix the root cause (auth, URL, network).","For auth failures, configure git credentials (SSH key or credential helper) for the repository host.","For network issues, fix proxy/VPN/DNS settings and retry the install/update.","Delete the broken clone directory and re-clone the package.","Run the failing git command manually in a terminal to confirm and diagnose."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var which = await ProcessRunner.RunBashAsync(\"command -v git\");\nif (which.ExitCode != 0) throw new Exception(\"git is not installed\");","typeGuard":null,"tryCatchPattern":"try { await helper.RunGit(\"pull\"); }\ncatch (ProcessException ex)\n{ logger.Error(ex, $\"git failed (code {ex.ExitCodeHint}); inspect stdout/stderr in message\"); }","preventionTips":["Configure git credentials/SSH keys for the repo host before installing packages.","Check connectivity to github.com from the target machine.","Run failing git commands manually to reproduce and diagnose.","Delete corrupted clones and re-clone."],"tags":["git","process-exit-code","package-install","linux"],"backgroundTag":"git-command-failed","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}