VSCode + WSL Remote + Git : Synchronizing changes take forever

Related searches

I'm using VSCode remotly into my project folder located (symlink) into WSL 2 VM. I cloned my repo from Bitbucket using SSH and the terminal.

On the bottom left corner, it indicate WSL: Ubuntu, so I'm currently using it remotly. ALL GOOD If I click the Git branch indicator, I can see local branchs and remote one. ALL GOOD

The problem is that when I click to synchronize everything after a local commit, it spins forever. Well, not really, I lose patience before forever happen... Currently about 30 minutes on the current test.

If I do git push into the terminal, everything goes as expected.

Any one got an idea on why it's doing this? How can I solve that problem?

My Git output into VSCode constantly return this git rev-parse --show-toplevel? I did git config for both user.name and user.email SSH key is set on Bitbucket. Windows and WSL 2 are using the same public/private key.

Thank you


I solved my issue. So, for thoses of you that want to give WSL 2 a try and encounter this, the issue come from the passphrase of the SSH-key.

https://code.visualstudio.com/docs/remote/troubleshooting#_resolving-hangs-when-doing-a-git-push-or-sync-on-an-ssh-host

Resolving hangs when doing a Git push or sync on an SSH host If you clone a Git repository using SSH and your SSH key has a passphrase, VS Code's pull and sync features may hang when running remotely. Either use an SSH key without a passphrase, clone using HTTPS, or run git push from the command line to work around the issue.

If you want to remove your passphrase, use $ ssh-keygen -p as mentioned into this question: https://stackoverflow.com/a/112409/5543999

microsoft/vscode: Visual Studio Code, Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux and Visual Studio Code's source code comes from Microsoft's free and open-source software VSCode project released under the permissive Expat´┐Ż Edit, debug, and deploy on Azure with Visual Studio Code, a powerful code editor that works with nearly any language and runs on any OS.


Rather would just do push and pull from the command line than removing the passphrase!

Visual Studio Code, Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.


You can also get around this issue by using ssh-agent.

Add the following to your ~/.bashrc and whenever you open a terminal you will be prompted to unlock your key(s) if not unlocked.

env=~/.ssh/agent.env

agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }

agent_start () {
    (umask 077; ssh-agent >| "$env")
    . "$env" >| /dev/null ; }

agent_load_env

# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)

if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
    agent_start
    ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
    ssh-add
fi

unset env

Source: https://docs.github.com/en/github/authenticating-to-github/working-with-ssh-key-passphrases#auto-launching-ssh-agent-on-git-for-windows

Furthermore, you can configure the expiry of keys added to the ssh-agent as follows - https://unix.stackexchange.com/questions/122511/configuring-the-default-timeout-for-the-ssh-agent

One place for all extensions for Visual Studio, Azure DevOps Services, Azure DevOps Server and Visual Studio Code. Discover and install extensions and subscriptions to create the dev environment you need.


VS Code is pretty good Its integrated terminal, global search, and extension marketplace are fantastic. But here's my beef: It's loaded with distractions and takes a ton of configuration to feel good. That's where this course comes in.


Visual Studio Code is a cross-platform script editor by Microsoft. Together with the PowerShell extension, it provides a rich and interactive script editing experience, making it easier to write reliable PowerShell scripts. Visual Studio Code with the PowerShell extension is the recommended editor for writing PowerShell scripts.


Visual Studio Codespaces environments have Live Share and IntelliCode built-in to enable real-time collaboration for your project and AI-assisted code recommendations based on best practices from thousands of open source repos.