gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
13.17k stars 521 forks source link

Git push failed - backend error: failed to execute git command: program not found #4142

Closed Nicolas-Innocent closed 4 months ago

Nicolas-Innocent commented 4 months ago

Version

0.12.5

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

me again xD

trying to push from win11 fails with backend error: failed to execute git command: program not found i have git installed on windows through git-bash (v 2.34.0.windows.1) vscode recognizes it natively (and gitbutler works locally otherwise, appart from the earlier issue (#4135) about network repo, only bugs with some remote stuff)

tried with code signing disabled as well, and force-push (just in case), no changes. the doc here https://docs.gitbutler.com/troubleshooting/fetch-push says to check the auth method, I do have that option on arch, but not in windows image

How to reproduce

No response

Expected behavior

No response

Relevant log output

2024-06-21T07:59:01.104126Z  INFO crates\gitbutler-tauri\src/main.rs:87: starting app version=0.12.5 name=GitButler
2024-06-21T07:59:01.246707Z  INFO get_user: crates\gitbutler-tauri\src\users.rs:12: new
2024-06-21T07:59:01.247041Z  INFO get_user: crates\gitbutler-tauri\src\users.rs:12: close time.busy=306µs time.idle=30.0µs
2024-06-21T07:59:01.248715Z  INFO list_projects: crates\gitbutler-tauri\src\projects.rs:40: new
2024-06-21T07:59:01.248896Z  INFO list_projects: crates\gitbutler-tauri\src\projects.rs:40: close time.busy=167µs time.idle=15.4µs
2024-06-21T07:59:01.403820Z  INFO get_project: crates\gitbutler-tauri\src\projects.rs:31: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.406935Z  INFO get_project: crates\gitbutler-tauri\src\projects.rs:31: close time.busy=3.09ms time.idle=21.6µs id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.408712Z  INFO set_project_active: crates\gitbutler-tauri\src\projects.rs:49: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.408760Z  INFO git_head: crates\gitbutler-tauri\src\commands.rs:68: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.410637Z  INFO set_project_active:watch: crates\gitbutler-tauri\src\watcher.rs:102: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.410828Z  INFO fetch_from_remotes: crates\gitbutler-tauri\src\virtual_branches.rs:500: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 action=Some("auto")
2024-06-21T07:59:01.428514Z  WARN git_head: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.428618Z  WARN fetch_from_remotes: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 action=Some("auto")
2024-06-21T07:59:01.432618Z  INFO git_head: crates\gitbutler-tauri\src\commands.rs:68: close time.busy=23.8ms time.idle=21.1µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.441946Z  WARN fetch_from_remotes: crates\gitbutler-core\src\virtual_branches\controller.rs:924: fetch from push-remote failed err=backend error: failed to execute git command: program not found

Caused by:
    failed to execute git command: program not found project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 action=Some("auto")
2024-06-21T07:59:01.448174Z  INFO set_project_active:watch:file monitor: crates\gitbutler-watcher\src\file_monitor.rs:119: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.544532Z  INFO get_base_branch_data: crates\gitbutler-tauri\src\virtual_branches.rs:103: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.550359Z  WARN get_base_branch_data: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.555786Z  INFO fetch_from_remotes: crates\gitbutler-tauri\src\virtual_branches.rs:500: close time.busy=145ms time.idle=20.1µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 action=Some("auto")
2024-06-21T07:59:01.555948Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:54: new event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47)
2024-06-21T07:59:01.555961Z  INFO handle:calculate_virtual_branches: crates\gitbutler-watcher\src\handler.rs:85: new event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47)
2024-06-21T07:59:01.559304Z  INFO get_base_branch_data: crates\gitbutler-tauri\src\virtual_branches.rs:103: close time.busy=14.8ms time.idle=19.7µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.562206Z  WARN handle:calculate_virtual_branches: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47)
2024-06-21T07:59:01.567547Z  INFO list_projects: crates\gitbutler-tauri\src\projects.rs:40: new
2024-06-21T07:59:01.567791Z  INFO list_projects: crates\gitbutler-tauri\src\projects.rs:40: close time.busy=224µs time.idle=19.9µs
2024-06-21T07:59:01.568873Z  INFO list_virtual_branches: crates\gitbutler-tauri\src\virtual_branches.rs:39: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.568948Z  INFO list_remote_branches: crates\gitbutler-tauri\src\virtual_branches.rs:452: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.576865Z  WARN list_remote_branches: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:01.611187Z  INFO list_remote_branches: crates\gitbutler-tauri\src\virtual_branches.rs:452: close time.busy=42.2ms time.idle=30.4µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:06.694773Z  INFO handle:calculate_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:146: new event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47) commit_oid=b68120193ce159cd54dd4f533ae7d0ebbd83b76a
2024-06-21T07:59:07.676301Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:07.677174Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: close time.busy=852µs time.idle=22.6µs id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 fs_events=815 fs_events=815 ignored=0 ignored=0 git_noop=815 git_noop=815 git=0 git=0 project=0 project=0
2024-06-21T07:59:19.550384Z  INFO handle:calculate_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:146: close time.busy=12.9s time.idle=32.2µs event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47) commit_oid=b68120193ce159cd54dd4f533ae7d0ebbd83b76a
2024-06-21T07:59:19.607257Z  INFO handle:calculate_virtual_branches: crates\gitbutler-watcher\src\handler.rs:85: close time.busy=18.1s time.idle=13.7µs event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47)
2024-06-21T07:59:19.607271Z  INFO handle: crates\gitbutler-watcher\src\handler.rs:54: close time.busy=18.1s time.idle=13.8µs event=VirtualBranch(dfb5c5b1-ca30-496f-9bca-0a0b2717eb47)
2024-06-21T07:59:19.618855Z  WARN list_virtual_branches: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:19.936921Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:19.936965Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: close time.busy=20.7µs time.idle=24.2µs id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 fs_events=6 fs_events=6 ignored=0 ignored=0 git_noop=6 git_noop=6 git=0 git=0 project=0 project=0
2024-06-21T07:59:23.657610Z  INFO list_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:146: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 commit_oid=83af96e9a9309617b0d8176d0585052a2859bfbb
2024-06-21T07:59:24.193207Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:24.194065Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: close time.busy=834µs time.idle=25.9µs id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 fs_events=815 fs_events=815 ignored=0 ignored=0 git_noop=815 git_noop=815 git=0 git=0 project=0 project=0
2024-06-21T07:59:39.821379Z  INFO list_virtual_branches:workdir: crates\gitbutler-core\src\git\diff.rs:146: close time.busy=16.2s time.idle=27.2µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 commit_oid=83af96e9a9309617b0d8176d0585052a2859bfbb
2024-06-21T07:59:39.879008Z  INFO list_virtual_branches: crates\gitbutler-tauri\src\virtual_branches.rs:39: close time.busy=20.3s time.idle=18.0s project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:39.880746Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:279: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc
2024-06-21T07:59:39.883946Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiModelProvider"
2024-06-21T07:59:39.884713Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=753µs time.idle=14.2µs key="gitbutler.aiModelProvider"
2024-06-21T07:59:39.891313Z  WARN can_apply_virtual_branch: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc
2024-06-21T07:59:39.892605Z  INFO can_apply_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:279: close time.busy=11.8ms time.idle=13.1µs project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc
2024-06-21T07:59:39.901177Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiOpenAIKey"
2024-06-21T07:59:39.901941Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=750µs time.idle=13.8µs key="gitbutler.aiOpenAIKey"
2024-06-21T07:59:39.902390Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiAnthropicKey"
2024-06-21T07:59:39.903260Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=856µs time.idle=16.1µs key="gitbutler.aiAnthropicKey"
2024-06-21T07:59:39.903704Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiOllamaEndpoint"
2024-06-21T07:59:39.904438Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=724µs time.idle=11.2µs key="gitbutler.aiOllamaEndpoint"
2024-06-21T07:59:39.904800Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiOllamaModelName"
2024-06-21T07:59:39.905655Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=841µs time.idle=13.6µs key="gitbutler.aiOllamaModelName"
2024-06-21T07:59:39.906086Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiModelProvider"
2024-06-21T07:59:39.906813Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=716µs time.idle=11.7µs key="gitbutler.aiModelProvider"
2024-06-21T07:59:39.907205Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiOpenAIKeyOption"
2024-06-21T07:59:39.907908Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=694µs time.idle=10.4µs key="gitbutler.aiOpenAIKeyOption"
2024-06-21T07:59:39.908568Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: new key="gitbutler.aiAnthropicKeyOption"
2024-06-21T07:59:39.909675Z  INFO git_get_global_config: crates\gitbutler-tauri\src\commands.rs:107: close time.busy=1.09ms time.idle=16.4µs key="gitbutler.aiAnthropicKeyOption"
2024-06-21T07:59:40.210312Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: new id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47
2024-06-21T07:59:40.210363Z  INFO set_project_active:watch:file monitor:handle debounced events: crates\gitbutler-watcher\src\file_monitor.rs:122: close time.busy=23.4µs time.idle=29.0µs id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 fs_events=6 fs_events=6 ignored=0 ignored=0 git_noop=6 git_noop=6 git=0 git=0 project=0 project=0
2024-06-21T07:59:45.999726Z  INFO push_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:262: new project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc with_force=false
2024-06-21T07:59:46.009252Z  WARN push_virtual_branch: crates\gitbutler-core\src\project_repository\repository.rs:44: failed to get gitbutler.didSetPrune for repository at S:\web\servers\hyperion; cannot disable gc: config value 'gitbutler.didSetPrune' was not found; class=Config (7); code=NotFound (-3) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc with_force=false
2024-06-21T07:59:46.108162Z ERROR push_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:262: error=Error(errors.unknown

Caused by:
    0: backend error: failed to execute git command: program not found
    1: failed to execute git command: program not found) project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc with_force=false
2024-06-21T07:59:46.108173Z  INFO push_virtual_branch: crates\gitbutler-tauri\src\virtual_branches.rs:262: close time.busy=88.3ms time.idle=20.1ms project_id=dfb5c5b1-ca30-496f-9bca-0a0b2717eb47 branch_id=ea4b0491-7da0-4c82-9331-35aa01bff4cc with_force=false
Byron commented 4 months ago

Thanks for reporting!

This isn't the first time I hear that GB can't find Git in the PATH. Can it be about the way Git is installed. I remember there were options whether or not to put it into the path.

Do you have git.exe available in a normal windows cmd.exe prompt? I am pretty sure that the PATH that GB sees isn't including the git.exe binary, and if so, it should be possible to check which PATH is set in a terminal where git works, compared to the system PATH.

Is this something you can investigate?

Nicolas-Innocent commented 4 months ago

Hi Byron,

Progress. sort of, so git bash existed in my $PATH, but not to the bin folder where git.exe lives. the element I had in the path was the git bash root, where git-cmd.exe is located. I had checked earlier, but seing the entry, didn't check it was correct. Added the correct path, and it now passes that, but fails with image

Interestingly, it did push to github (abeit without the ssh signature), but did not propose to me creating the PR. Did that on github, updated the workspace, and it synced correctly (but VERY SLOWLY, and yes, hunk algo was enabled)

did another push for testing (one line of code) and got the same error (over 30s to prepare the push, which take maybe 3-4 sec on this project via the gitbutler on my arch box (obviously I'm not lauching both at the same time))

note that those error don't appear in the log as is

Byron commented 4 months ago

Thanks for sharing this valuable insight! I had a feeling that the PATH doesn't actually contain the binary itself.

As for the sluggish push performance, that's still puzzling me, and so is that the no elements in sequence doesn't show up in the logs. Maybe the frontend can also show frontend errors there, and that's what's happening when there is an unexpected response? When searching for it, it appears in frontend code close to EmptyError.

In any case, it's strange there is no error in the logs. The only time I noticed this happening is when something panics (i.e. a hard crash), which only shows up on stdout when using the development version directly.

Maybe this is something you could try, even though it's quite involved on Windows.

Byron commented 4 months ago

And I just realize that on Windows, GitButler could be smarter and see if bash.exe is in the PATH - from there it would be able to figure out the path of git.exe by invoking bash. There is probably a lot of people who didn't put git.exe into the path.

Lastly, all of this would be resolved if there was no dependency to git.exe at all and everything could be done directly from within GitButler.

Nicolas-Innocent commented 4 months ago

GitButler.log.2024-06-24.txt here is the full log of today's test. not a single occurence of the string error or elements in there

the path pointed to a floder containing git-bash.exe and git-cmd.exe. the real git.exe is in a bin subfolder along with bash.exe and sh.exe

Byron commented 4 months ago

I am investigating this.

It's interesting that the default wants to put git.exe into the PATH, but ideally GitButler can handle the bash-only installation as well.

Screenshot 2024-06-24 at 10 09 21

It turns out that unfortunately, when the first option is chosen, the PATH is entirely unaltered, and looks like this on a fresh installation: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\byron\AppData\Local\Microsoft\WindowsApps;

With that it's not possible to find conclude from bash.exe to the Git binary. However, I think it can still be an improvement if some standard installation directories would be tried.

Byron commented 4 months ago

The fix will be available in the Nightly build starting tomorrow, at the latest.