microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.33k stars 28.59k forks source link

Git push hangs #121231

Closed jaanli closed 1 year ago

jaanli commented 3 years ago

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(R) Core(TM) 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:

image

^ the spinner status icon just keeps spinning...

Any ideas?

eamodio commented 3 years ago

Are you using any remote connection? or just a local repository?

jaanli commented 3 years ago

This is a local repository, trying to push to a remote hosted on github.com.

One important piece of info could be:

I was getting a 'permissions too open' publickey error Permission denied (publickey) that was very tricky to debug (because it only occurred in VS code, not in WSL, Windows Terminal, Powershell, git bash, etc).

The way I debugged that:

(1) Replicate the error in all the above terminals by changing to the same git that VS code uses:

git config --global core.sshCommand C:\\Windows\\System32\\OpenSSH\\ssh.exe

(2) Fix permissions in the publickey file using the following script in an elevated powershell: https://superuser.com/questions/1296024/windows-ssh-permissions-for-private-key-are-too-open (with one important detail! It was crucial to copy and paste the public key file, delete the original, and rename the copied version. Changing the permissions on the file in-place did not work, and I tried many, many things :)

# DO the following in powerhsell if not already done:
# Set-ExecutionPolicy RemoteSigned

# NOTE: edit the path in this command if needed
$sshFiles=Get-ChildItem -Path "$env:userprofile\.ssh" -Force

$sshFiles | % {
  $key = $_
  & icacls $key /c /t /inheritance:d
  & icacls $key /c /t /grant  "${echo $env:username}":F
  & icacls $key /c /t /remove Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users
}

# Verify:
$sshFiles | % {
  icacls $_
}

Git pull, etc continues to work everywhere else except VS Code, where it hangs.

There seems to be something weird going on.

Please let me know if any other details would be helpful!

NicoJG commented 3 years ago

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.

noelmatias commented 3 years ago

Set the GIT_SSH environment variable to work with OpenSSH running [Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User) in PowerShell

bendras commented 3 years ago

I have similar issue. Using Visual Studio Code dev channel, WSL2 Ubuntu, Docker desktop.
Repository is on Ubuntu file system. GIT is authenticated with username and password. Docker is enabled on the Ubuntu WSL2. node.js must be installed on WSL2 distro I think.

Visual studio command to sync repository works OK when no changes to push. But when it relates to commit and then Sync, it will spin forever...

I have installed WSL2 with Windows Insiders dev channel. Install VS Code and the Remote WSL extension. Followed Get started using Git on Windows Subsystem for Linux and git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"

SYSTEM INFORMATION
CPUs | Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz (8 x 2304)
-- | --
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled
Load (avg) |  
Memory (System) | 47.73GB (20.09GB free)
Process Argv | --crash-reporter-id b10a77b3-4cf2-4d61-bba6-156cdc768ae4
Screen Reader | no
VM | 0%

Remote | WSL: Ubuntu-20.04
-- | --
OS | Linux x64 5.10.16.3-microsoft-standard-WSL2
CPUs | Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz (4 x 2304)
Memory (System) | 15.63GB (7.18GB free)
VM | 0%
ENABLED EXTENSIONS
Extension | Author (truncated) | Version
-- | -- | --
remote-containers | ms- | 0.174.0
remote-ssh | ms- | 0.65.4
remote-ssh-edit | ms- | 0.65.4
remote-wsl | ms- | 0.56.1
vscode-eslint | dba | 2.1.20
vscode-monorepo-workspace | fol | 1.3.1
vscode-docker | ms- | 1.12.1

References:

bendras commented 3 years ago

I suspect it is related to PATH.

$ whereis git
git: /usr/bin/git /mnt/c/Program Files/Git/cmd/git.exe /usr/share/man/man1/git.1.gz
NicoJG commented 3 years ago

For me I'm sure it has something to do with SSH authentication. On those git repositories with a remote adress like git@github.com:NicoJG/... it just hangs on every pull or push, but on those git repositories with a remote adress like https://github.com/NicoJG/... it just works fine and I just have to authenticate VSCode via the GitHub website.

I tried

Set the GIT_SSH environment variable to work with OpenSSH running [Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User) in PowerShell

as @noelmatias suggested. But it did not work. Maybe VSCode has a problem authenticating via SSH when it is working remotely with my WSL2.

bendras commented 3 years ago

Here is another example.
Here what I was doing:

  1. yarn add notistack -- this operation timed out...
  2. ping yarnpkg.com -- no waiting time, just run it.
  3. yarn add notistack -- no waiting time, just run it. Success!

My current workaround: run ping commant to resolve DNS entries required for the next command.
:D it is funny, but it works

bendras@PZ-P15s:~/nms/web$ yarn add notistack
yarn add v1.22.10
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/notistack: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/home/bendras/nms/web/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
bendras@PZ-P15s:~/nms/web$ ping yarnpkg.com
PING yarnpkg.com (173.245.59.69) 56(84) bytes of data.
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=1 ttl=54 time=7.34 ms
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=2 ttl=54 time=5.96 ms
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=3 ttl=54 time=6.78 ms
^C
--- yarnpkg.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 5.964/6.693/7.335/0.563 ms
bendras@PZ-P15s:~/nms/web$ ping yarnpkg.com
PING yarnpkg.com (173.245.59.69) 56(84) bytes of data.
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=1 ttl=54 time=8.77 ms
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=2 ttl=54 time=4.57 ms
64 bytes from arnold.ns.cloudflare.com (173.245.59.69): icmp_seq=3 ttl=54 time=16.0 ms
^C
--- yarnpkg.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 4.565/9.763/15.956/4.703 ms
bendras@PZ-P15s:~/nms/web$ yarn add notistack
yarn add v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @date-io/moment@1.3.13" has unmet peer dependency "moment@^2.24.0".
warning " > @material-ui/pickers@3.3.10" has unmet peer dependency "@date-io/core@^1.3.6".
warning " > @material-ui/pickers@3.3.10" has unmet peer dependency "prop-types@^15.6.0".
warning "@wojtekmaj/enzyme-adapter-react-17 > enzyme-adapter-utils@1.14.0" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0".
warning "@wojtekmaj/enzyme-adapter-react-17 > enzyme-adapter-utils > airbnb-prop-types@2.16.0" has incorrect peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha".
warning " > mui-datatables@3.7.4" has incorrect peer dependency "react@^16.8.0".
warning " > mui-datatables@3.7.4" has incorrect peer dependency "react-dom@^16.8.0".
warning "mui-datatables > react-sortable-tree@2.8.0" has incorrect peer dependency "react@^16.3.0".
warning "mui-datatables > react-sortable-tree@2.8.0" has incorrect peer dependency "react-dnd@^7.3.0".
warning "mui-datatables > react-sortable-tree@2.8.0" has incorrect peer dependency "react-dom@^16.3.0".
warning "mui-datatables > react-sortable-tree > frontend-collective-react-dnd-scrollzone@1.0.2" has incorrect peer dependency "react-dnd@^7.3.0".
warning "mui-datatables > react-sortable-tree > react-virtualized@9.22.3" has incorrect peer dependency "react@^15.3.0 || ^16.0.0-alpha".
warning "mui-datatables > react-sortable-tree > react-virtualized@9.22.3" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0-alpha".
warning "react-map-gl > react-virtualized-auto-sizer@1.0.4" has incorrect peer dependency "react@^15.3.0 || ^16.0.0-alpha".
warning "react-map-gl > react-virtualized-auto-sizer@1.0.4" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0-alpha".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ notistack@1.0.7
info All dependencies
└─ notistack@1.0.7
Done in 7.66s.
bendras@PZ-P15s:~/nms/web$ 
bendras commented 3 years ago

It varies how workarounds work :D
Attaching action timeline on 2 console windows

image

hkhanna commented 3 years ago

I also have this issue. I am running a WSL2 remote, and pushing only works if I have my ssh key's passphrase in my ssh-agent in WSL2. In other words, I have to remember to ssh-add before pushing in VSCode, or VSCode will hang indefinitely.

maxgonzalezb commented 3 years ago

Having the same issue. Git push hangs on Git Bash but works in PowerShell. Added seveal ssh-related .exes to windows firewall with no success.

DominicH247 commented 3 years ago

having the same issue on WSL2 - Git push just hangs in the VSCode terminal, this occured after updating to to latest version (1.57), all my extensions no longer work either :-(

Lokdal commented 3 years ago

I also have this issue. My repo is not in WSL 2, though I have a WSL 2 installed and have a repo there. Unsure whether the issue affects my repos in WSL 2 or not.

JMPZ11 commented 3 years ago

Same.

eddyizm commented 3 years ago

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.

ghost commented 3 years ago

I solved this on Windows 11 with WSL2 by installing keychain and adding it to my bashrc: https://esc.sh/blog/ssh-agent-windows10-wsl2/

Now I'm able to use the GUI again.

codewith-arijit commented 2 years ago

Anyone got any proper solution to this problem? I am facing the same issue. OS: Ubuntu

bendras commented 2 years ago

Anyone got any proper solution to this problem? I am facing the same issue. OS: Ubuntu

Yes (kind off), install the Windows 11 beta . Problem went away for me.
😆

ortzinator commented 2 years ago

Set the GIT_SSH environment variable to work with OpenSSH running [Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User) in PowerShell

This worked for me!

rostlin commented 2 years ago

I have the same issue, git hangs when I push using the gui. I can get it to hang without WSL using for example stable version 1.60.2 (windows build: 20H2) using https remote both to Github and Azure devops. If I push using the terminal instead it works. If I use the gui it most often doesnt work and I have to restart vs code. I get the feeling that if I restart my computer and just open vscode (one instance) it works for a while, until it doesnt and then it wont start working unless I restart my computer, then it might. I dont have any other issues with git from vs, sourcetree, wsl or other terminals. This should work out of the box, I also know others with the same issue and sometimes get the same problem from my macbook using parallels. / vscode lover

FernandoMiguel commented 2 years ago

on mac 11 and this started a month ago. can't push anything .. but if i commit and the push the new branch, that works. opening a terminal within vscode, also works fine. my repos are in a corporate git instance and i use a PAT token within macos keychain.

Version: 1.62.0-insider (Universal)
Commit: 45fdad3a10d437fb0a45cc008eecca7c35021fb2
Date: 2021-10-25T05:13:17.888Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0
zoltan-magyar commented 2 years ago

It can be fetch, pull or push, but most often one of these hangs forever. Sometimes it works, but it is incredibly rare.

One curious thing is this error in the git log:


Opening repository for path='/home/zoltanmagyar/.ssh' failed; ex=Failed to execute git {
  "exitCode": 128,
  "gitErrorCode": "NotAGitRepository",
  "gitCommand": "rev-parse",
  "stdout": "",
  "stderr": "fatal: not a git repository (or any of the parent directories): .git\n"
}
proddy commented 2 years ago

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

cspotcode commented 2 years ago

Is this caused by a bug in VSCode's GIT_ASKPASS implementation?

When I run $GIT_ASKPASS in a VSCode integrated terminal, I get dumped into a node REPL. I'm pretty sure that's not supposed to happen; rather, it's supposed to run a script that behaves as a git askpass implementation per https://git-scm.com/docs/gitcredentials

cspotcode commented 2 years ago

Here's what I found was happening on my machine:

$ cat $GIT_ASKPASS
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE

$ export | grep VSCODE_GIT_ASKPASS_EXTRA_ARGS
declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS=""

This means that $GIT_ASKPASS is passing the empty string as the first positional argument to node, 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

rost-git commented 2 years ago

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

priyanshuone6 commented 2 years ago

@havarez thanks, it worked for me

asmaaaly99 commented 2 years ago

Same here!

kazuemon commented 2 years ago

@cspotcode

My workaround is export VSCODE_GIT_ASKPASS_EXTRA_ARGS="--title=foobar" but the proper bugfix should happen in VSCode's GIT_ASKPASS implementation.

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.

lszomoru commented 2 years ago

Extracted the issue related to $GIT_ASKPASS into a separate issue and marked it as a candidate.

localpath commented 2 years ago

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

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

bdlake commented 2 years ago

Here's what I found was happening on my machine:

$ cat $GIT_ASKPASS
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE

$ export | grep VSCODE_GIT_ASKPASS_EXTRA_ARGS
declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS=""

This means that $GIT_ASKPASS is passing the empty string as the first positional argument to node, 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: ac29daa

Thank you! This worked for me

Guilospanck commented 2 years ago

Here's what I found was happening on my machine:

$ cat $GIT_ASKPASS
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE

$ export | grep VSCODE_GIT_ASKPASS_EXTRA_ARGS
declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS=""

This means that $GIT_ASKPASS is passing the empty string as the first positional argument to node, 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: ac29daa

Thanks! It worked for me as well.

ElliotP123 commented 2 years ago

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

Broke suddenly for me this morning, this solved the issue. Also works for git clone, etc.

gabesargeant commented 2 years ago

Thanks @cspotcode fixed the issue for me.

kazukinagata commented 2 years ago

@cspotcode Your are a life-saver! thanks a lot.

DmitryMasley commented 2 years ago

Happens to me too. But if I start VSCode from WSL terminal there are no issues.

Guilospanck commented 2 years ago

export VSCODE_GIT_ASKPASS_EXTRA_ARGS="--title=foobar"

Stopped working this morning. Had to do it again. Edit: in fact, I must do it for every single different repository.

tanwarsatya commented 2 years ago

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe" worked for me as mentioned in the document link shared by @localpathcomp.

My question is what got changed suddenly that's causing this issue?

dettjw01 commented 2 years ago

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

This solution absolutely worked for me. HUGE thank you! I looked for several days before I found this.

bugoverdose commented 2 years ago

@cspotcode Works like a charm. thx

cspotcode commented 2 years ago

export VSCODE_GIT_ASKPASS_EXTRA_ARGS="--title=foobar"

Stopped working this morning. Had to do it again. Edit: in fact, I must do it for every single different repository.

You must do it for every single shell, not just repository.

An alternative is to edit the $GIT_ASKPASS file directly and remove the double-quotes around the EXTRA_ARGS variable.

cookiestroke commented 2 years ago

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe" worked for me as mentioned in the document link shared by @localpathcomp.

My question is what got changed suddenly that's causing this issue?

I'm wondering the same, did the credential check process change for those who use 2FA in this new update? I've noticed most of the time this bug happened, it was to those who were using 2FA and WSL.

demul commented 2 years ago

I 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.

proddy commented 2 years ago

Looks like the fix made it into the latest VSC 1.62.2 https://github.com/microsoft/vscode/issues/136837

jacint-david commented 2 years ago

Hey All, I had a similar issue just 20 mins ago. Thankfully with a bit of research and experimentation I've managed to find a proper fix. TLDR: this solved it for me

In my case the 'git push origin main' was just 'hanging' not doing anything when I used the VS Code integrated terminal on the other hand when I tried using the proper outer terminal it requested login confirmation where upon entering the pw I got an error message saying that they no longer accept personal pws for authorizing terminal commands, so I went ahead and created a PERSONAL ACCESS TOKEN, then I reset the credential helper file where instead of my personal pw I provided the PAT and the next git command that I executed where I used the PAT instead of PW, saved my whole login deets. I went ahead and made another commit-push in the integrated terminal of VS Code and it worked there too afterwards. So retrospectively it appears to me that the integrated terminal was probably stuck because it was trying to use my personal pw.

lucafrancescato commented 2 years ago

I 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.

I think that the reason for which it started working again after unsetting and then setting again the option to true is because by doing so the Git extension resets the VSCODE_GIT_ASKPASS_EXTRA_ARGS variable to an empty value, thus making everything work again.

lszomoru commented 2 years ago

The regression in 1.62.2 is being tracked here - https://github.com/microsoft/vscode/issues/137183. Fix will be included in 1.62.3. Apologies for the inconvenience.

guihlr commented 2 years ago

Set the GIT_SSH environment variable to work with OpenSSH running [Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User) in PowerShell

This worked for me!

codename5281 commented 2 years ago

Set the GIT_SSH environment variable to work with OpenSSH running [Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User) in PowerShell

This worked for me as well - password prompt now showing up, though I wouldn't be able to say if it's because of this or if I rebooted VScode.