vscode: Git push hangs
Issue Type: Bug
Git push works on Windows Terminal, Powershell, WSL2, but it hangs in VS Code.
Log file from Git in VS Code:
Looking for git in: C:\Program Files\Git\cmd\git.exe Using git 2.31.1.windows.1 from C:\Program Files\Git\cmd\git.exe
git status -z -u git symbolic-ref --short HEAD git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git check-ignore -v -z --stdin git status -z -u git symbolic-ref --short HEAD git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) git remote --verbose git config --get commit.template git config --get commit.template git push origin main:main
VS Code version: Code - Insiders 1.56.0-insider (48387dfc3d691558404cff1ea2582e3862a40080, 2021-04-13T05:15:20.350Z) OS version: Windows_NT x64 10.0.19042
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-4980HQ CPU @ 2.80GHz (8 x 2794) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.88GB (8.07GB free) |
Process Argv | –crash-reporter-id 6e69df9d-4014-49e0-b08c-d7ad3cd49a41 |
Screen Reader | no |
VM | 0% |
Extensions (20)
Extension | Author (truncated) | Version |
---|---|---|
docs-view | bie | 0.0.9 |
vscode-pandoc | Dou | 0.0.8 |
file-icons | fil | 1.0.29 |
latex-workshop | Jam | 8.16.1 |
vscode-markdown-notes | kor | 0.0.24 |
python | ms- | 2021.4.727679055-dev |
jupyter | ms- | 2021.6.744171703 |
remote-containers | ms- | 0.167.0 |
remote-ssh | ms- | 0.65.1 |
remote-ssh-edit | ms- | 0.65.1 |
remote-wsl | ms- | 0.56.0 |
vscode-remote-extensionpack | ms- | 0.20.0 |
powershell | ms- | 2021.2.2 |
powershell-preview | ms- | 2021.4.1 |
vscode-paste-image | mus | 1.0.4 |
advanced-new-file | pat | 1.2.2 |
vscode-yaml | red | 0.17.0 |
save-as-firstline | tra | 0.0.8 |
markdown-pdf | yza | 1.4.4 |
markdown-all-in-one | yzh | 3.4.0 |
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry244:30244315
pythonvsdeb440:30224570
pythonvsded773:30223139
pythonvspyt875:30259475
pythonvsnew554:30265444
pythontb:30258533
openwslfolder:30278404
vspre833cf:30267465
pythonptprofiler:30281269
vscnewfiletextcf:30288478
vshan820cf:30276953
vscorecescf:30285484
pythondataviewer:30285072
vscus158cf:30286554
vscgsv2:30286872
Git push from the command palette just hangs with no error or anything - over 10 minutes already. It works fine everywhere else. This is what I see:
^ the spinner status icon just keeps spinning…
Any ideas?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 19
- Comments: 61 (3 by maintainers)
Here’s what I found was happening on my machine:
This means that
$GIT_ASKPASS
is passing the empty string as the first positional argument tonode
, which causes it to launch a REPL instead of running the script$VSCODE_GIT_ASKPASS_MAIN
.My workaround is
export VSCODE_GIT_ASKPASS_EXTRA_ARGS="--title=foobar"
but the proper bugfix should happen in VSCode’s GIT_ASKPASS implementation.This bug appears to have been introduced by this security bugfix: https://github.com/microsoft/vscode/commit/ac29daaf3b35fe21fb9121312b1f37851d650ce8
If you can use Github Personal access tokens then go here Generate New Token and run this in your repo folder
git remote set-url origin https://<personal_access_token>@github.com/<user>/<repo>.git
Worked for me
I have the same issue. (All my friends have this issue) The commit in VSCode works fine but the pull or push command just won’t work. There is no error message and the Source Control Tab on the left is stuck with the clock symbol. In the git out there is only
git push origin main:main
and nothing after that.I use WSL2 with Ubuntu and VSCode installed on Windows connected via “Remote - WSL”. It worked a few months ago but now it does not.
I had a similar issue when I re-installed git from Windows 11. What fixed it for me was opening a terminal window in WSL2 or VSCode and typing the command shown at https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-git#git-credential-manager-setup
Looks like the fix made it into the latest VSC 1.62.2 https://github.com/microsoft/vscode/issues/136837
Extracted the issue related to
$GIT_ASKPASS
into a separate issue and marked it as a candidate.I solved this on Windows 11 with WSL2 by installing
keychain
and adding it to mybashrc
: https://esc.sh/blog/ssh-agent-windows10-wsl2/Now I’m able to use the GUI again.
Set the GIT_SSH environment variable to work with OpenSSH running
[Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User)
in PowerShellI solve this by, editting “setting.json” Set the flag “git.terminalAuthentication” be false(default is true) It works for me.
and, The somewhat strange thing is that, when i restore the flag above(“git.terminalAuthentication”: true) after once set it as false, It still works! but in somewhat different way, It pop up browser of github page that requests authentication.
Maybe the blocking after “git pull”(or git push or git clone or etc…) is caused by waiting for authentication on browser, and there may be some bugs on utility which pop up brower.
@cspotcode
I just experienced the same problem in my environment (Remote-WSL) , but the problem was solved by setting this environment variable.
Thank you very much for finding the solution.
Some more testing done.
With a newly installed WSL instance from the Microsoft Store, git is unable to clone, push, pull with a password protected SSH key.
I’m going to open another ticket for this is this seems more like a real issue affecting the SSL subsystem.
Im having this issue, after reinstalling my WSL instance. VSCode 1.68.1 Windows (Running in WSL instance)
Ive tried;
I would have thought this is a serious security concern given the solution. with keychain running and able to push via a terminal in and out of VSCode.
THis is the only thing that worked for me. Haven’t had issue with WSL2 and git command line for over a year and it all of a sudden started after a windows update.
https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-git#git-credential-manager-setup
I thought I was the only one having this issue. However, I am SSH’ing into another machine on the same network and trying to push. Hangs forever, turned the
-v
flag to see what was happening, nothing. One day I was freaking out because my changes weren’t in the repo and panicked all monday only to see the machine was still hanging. Walked over to the SSH’ed into machine (same office) and did a git push, no problem. Doesn’t seem to be related specifically to VSCode but to Git Bash in my case on a windows machines.