Skip to content
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

"Git: Failed to execute git" dialog but git works in terminal #58910

Closed
fischeme opened this issue Sep 18, 2018 · 21 comments
Closed

"Git: Failed to execute git" dialog but git works in terminal #58910

fischeme opened this issue Sep 18, 2018 · 21 comments
Assignees

Comments

@fischeme
Copy link

@fischeme fischeme commented Sep 18, 2018

Issue Type: Bug

As of approximately August, git integration no longer works, but git commands work fine from the terminal within VS Code.

I can reliably reproduce by opening a project folder with .git repository, clicking on source control tab in sidebar and pressing "Refresh" icon. VS Code then presents a dialog with "Git: Failed to execute git". From there, opening the git log shows a normal log, with a series of commands and no errors:

Looking for git in: C:\Program Files\Git\cmd\git.exe
Using git  from C:\Program Files\Git\cmd\git.exe
> git rev-parse --show-toplevel
> git config --get commit.template
Open repository: \.
> git status -z -u
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel

...the log shows periodic calls to the following two commands from then on:
> git status -z -u
> git rev-parse --show-toplevel

user.email and user.name are already set globally so this solution is not a problem.

Issue occurs on insider edition of VS code and it also occurs when running as administrator and when running with --disable-extensions.

VS Code version: Code 1.27.2 (f46c4c4, 2018-09-12T16:17:45.060Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz (8 x 2793)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.63GB (7.97GB free)
Process Argv C:\Users\IBM_ADMIN\AppData\Local\Programs\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
jshint dba 0.10.20
php-debug fel 1.12.5
printcode nob 2.3.1
@vscodebot vscodebot bot added the git label Sep 18, 2018
@fischeme
Copy link
Author

@fischeme fischeme commented Sep 18, 2018

Also would add that --verbose gave no clue on problems. I think we just need to get at exactly what is failing in the git call... I believe this is an edge case related to something about my workstation's configuration - environment, path, permissions. I am suspicious that VSCode is internally executing git in a way that is not the same as is happening in terminal.

@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Sep 19, 2018

Can you reproduce in other git repositories in your system?

Open repository: .

This line specifically is strange. It's expected to see an absolute path over there.

@fischeme
Copy link
Author

@fischeme fischeme commented Sep 19, 2018

At the time this occurred I had two projects under git control and both broke. I added a new project, and it broke too. As a sanity check, I opened one of the projects in the Netbeans IDE and it correctly integrated with git, showing project status, current branch, and allowing me to diff a changed file in the IDE. So I think git and the git repo are fine.
The first symptom I noticed of the problem was that vscode was no longer showing the current branch in the footer.
Incidentally, I have uninstalled both vscode and git multiple times with no effect.

@fischeme
Copy link
Author

@fischeme fischeme commented Sep 20, 2018

Probably TMI, but I had been having problems installing Microsoft OS updates for some time (computer appeared to be hung after install and I rolled back updates). Today, I let the update process run in its hung state for several hours and the updates seem to have installed. I see a lot of MS Office updates have installed plus Windows OS updates KB4457044 and 4457144. Now GIT is working again in VS Code. VS Code GIT integration is now working again after 2 months. I can only conclude that the previously failed updates had left some aspect of my system in a strange state or the update process included a disk or os scan/repair that resolved the underlying issue. I will say that during this period, no other aspect of my system failed besides VS Code/GIT, which was certainly strange. I think this issue can be closed but might be useful as a reference in case others see the same thing. For sake of completeness, one other symptom I had noticed was that GIT GUI under Windows was also failing to launch - and that is resolved as well. As I had never used GIT GUI previously I assumed it had always been broken but now it seems related to the same root issue. Thanks for your time.

@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Sep 20, 2018

No repository works, then?

Are the repositories located in a special file system, eg remote?

@fischeme
Copy link
Author

@fischeme fischeme commented Sep 20, 2018

Joao, looks like we posted at the same time (see my comment above)... strangely a Windows system update solved the problem. To answer your last question though, all repositories were affected and they were in the local file system. So there is a strange dependency on some aspect of the OS. I'm going to close this issue.

@fischeme fischeme closed this Sep 20, 2018
@mrkbutty
Copy link

@mrkbutty mrkbutty commented Sep 27, 2018

I have the same problem.
Git works everywhere except within VScode.
Changes are not tracked - I even delete repository and initialized again and still does not work.
At the moment manual git terminal commands are needed.

Similar git log output; with no results to the command;

Looking for git in: C:\Program Files\Git\cmd\git.exe
Using git  from C:\Program Files\Git\cmd\git.exe
> git rev-parse --show-toplevel
> git config --get commit.template
Open repository: \.
> git rev-parse --show-toplevel
> git status -z -u
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
@fischeme
Copy link
Author

@fischeme fischeme commented Sep 27, 2018

@mrkbutty, if you have the same problem I had, then GIT GUI will also fail to launch with an error. Solution on Win7 strangely came from a system update - see if the specific system updates I mentioned are applied on your machine perhaps. This is still a very odd problem so maybe @joaomoreno will want to work with you now that it's been seen again...

@mrkbutty
Copy link

@mrkbutty mrkbutty commented Sep 28, 2018

@fischeme Yes it is strange as it was working a week or so ago. I also have similar problem in pycharm (which was also working fine a week ago). Pycharm says "Cannot run git: Empty git --version output". So I do think this is environmental.

But I can run git fine in any console.

I have seen a similar problem in the past when "Beyond Trust" service was stopping Docker from controlling VBox. It interfered which with spawning of the VBox CLI commands - stopping the service fixed it.

  • No such luck this time though! I have looked at monitoring output from Carbon Black and the running of Git does seem to work successfully in both VsCode and PyCharm - it looks like the output streams are getting interference which stops the parents from picking up the output.

You wouldn't happen to know which update was applied do you? - My Win7 system seems up to date based on fixes released by my Organisation (I suspect we lag the most up to date fixes).

I would be happy to work with @joaomoreno or anyone to fix this so I don't have to manually run Git at terminal.

@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Sep 28, 2018

@mrkbutty Maybe try fully reinstalling Git and VS Code.

@mrkbutty
Copy link

@mrkbutty mrkbutty commented Sep 28, 2018

Some more intrigue....

I created 2x scripts one in python another in go, below are the scripts and output.
Python works but Go does not...

import subprocess
result = subprocess.run(['C:\Program Files\Git\cmd\git.exe', '--version'], stdout=subprocess.PIPE)
print('stdout:', result.stdout)
C:\temp>testgit.py
stdout: b'git version 2.19.0.windows.1\n'
package main
import (
	"bytes"
	"fmt"
	"log"
	"os/exec"
)
func main() {
	cmd := exec.Command("C:\\Program Files\\Git\\cmd\\git.exe", "--version")
	var stdout bytes.Buffer
	var stderr bytes.Buffer
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	err := cmd.Run()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("StdOut: %q\n", stdout.String())
}
C:\temp>testgit.exe
StdOut: ""
@fischeme
Copy link
Author

@fischeme fischeme commented Oct 1, 2018

@mrkbutty, see my post from Sep 19 for the OS updates that were done. Still not sure if it was the updates themselves or housekeeping as part of the update process (does the update process always do an OS scan and repair?) that did the trick for me. A whole bunch of other updates related to MS Office were also installed plus an update to .NET (KB44577035). I would focus first on making sure you have the Windows and NET updates then I can send you the long list of Office Updates that were done but would be surprised if those mattered.

@mrkbutty
Copy link

@mrkbutty mrkbutty commented Oct 1, 2018

@fischeme yes I have the same issue with gitgui. But I also have all those updates already installed.
I have a bad feeling this may relate to carbon black, I've had nothing but problems ever since my corporate started to use it.

@zhiminwen
Copy link

@zhiminwen zhiminwen commented Oct 9, 2018

I have the same issue since around August. The git command is running fine from the cmd shell. But not for the VScode.

I am using the git from cmder. This is the git window output

Using git  from C:\Tools\cmder\vendor\git-for-windows\cmd\git.exe
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git config --get commit.template
Open repository: \.
> git status -z -u
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git status -z -u

@mrkbutty, I have the same output as your go program. No output of the go program.

Funny enough, I also have the Carbon Black installed around August time frame...

I have no choice now to work the git stuff from command line... Please share any update on this issue.

@fischeme
Copy link
Author

@fischeme fischeme commented Oct 17, 2018

The plot thickens... I also got Carbon Black in August, exactly when my problems began. But then they resolved.... I have version 3.2.1.51 of "Cb Defense Sensor 64-bit". Maybe I got an update? I'm going to reopen this as it seems to be an interaction that the MS team will want to dig into some more... Here there is some discussion about dependence on vendor patches and weirdness about if/when a registry key should be pushed... https://www.carbonblack.com/2018/01/05/carbon-black-solutions-currently-compatible-major-os-vendor-patches-meltdown-spectre/

@fischeme
Copy link
Author

@fischeme fischeme commented Oct 17, 2018

Reopening due to multiple instances of this now and better information on possible root cause...

@fischeme fischeme reopened this Oct 17, 2018
@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Oct 19, 2018

I'm gonna focus here on @fischeme, since he already has a lot of detail around his issue. If you feel like you have a similar issue, please file a new one.

@fischeme Let's try to keep this simple: Does this reproduce on every git repository in your system?

@fischeme
Copy link
Author

@fischeme fischeme commented Oct 19, 2018

Sorry @joaomoreno , as you may recall, the issue resolved itself on my system after a Windows update in mid September, so I cannot recreate what I saw starting in mid August. But when I had the problem, it impacted every git repo I tried, including a new one I created. Those same git repos worked fine with another IDE (NetBeans). I previously provided the two OS updates that were applied at the time the problem resolved, but it seems other users already had those so perhaps they are not what did the trick. you might be better working with the others because they both seem to still have the problem.

@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Oct 22, 2018

@fischeme Do you still have the issue?

@fischeme
Copy link
Author

@fischeme fischeme commented Oct 23, 2018

I do not have the issue any longer (see: #58910 (comment))

@joaomoreno joaomoreno closed this Oct 23, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.