Git Features not Working in VS Code, Windows 10

Viewed 718

I have a few computers I dev on, been using VS Code for many years, never had a problem. But my new computer's VS Code is missing most Git features, can't even Git Fetch from VS Code, BUT git works great in CMD, Powershell, and Git Bash.

My setup is: Windows 10.0.19041 VS Code 1.52.1 Git for Windows 2.30.0.windows.1

I have an SSH key with a passphrase in: C:/Users/USERNAME/.ssh/id_rsa

The sidebar Git seems to do local tasks, it will tell me how many files have been modified, and I can commit from there. I'm (sorely) missing the gutter changed/added indicators, and when I try to use Git Fetch from the command bar (Ctrl + P) it fails, here's the output:

> git fetch
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
> git ls-files --stage -- C:\Users\wesru\reveal.js\css-training-rh.html
> git cat-file -s 9bf549982195171a7da63ada6e04fa5fa6561242
> git show --textconv :css-training-rh.html
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse gh-pages
> git rev-parse --symbolic-full-name gh-pages@{u}
> git rev-list --left-right gh-pages...refs/remotes/origin/gh-pages
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
Warning: Failed to watch ref 'c:\Users\wesru\reveal.js\.git\refs\remotes\origin\gh-pages', is most likely packed.
> git config --get commit.template

It's a public repo on Github, on my local file system. It makes no sense why I can't fetch.

I can press Ctrl backtick to get a powershell console and type git fetch -v and get:

PS C:\Users\wesru\reveal.js> git fetch -v
Enter passphrase for key 'C:\Users\wesru\.ssh\id_rsa': 
From github.com:wesruv/reveal.js
 = [up to date]      gh-pages   -> origin/gh-pages

I have tried:

  • Reinstalled Git and VS Code
  • Simplifying .gitconfig in my Users folder
  • Adding more specificity and adding github.com IdentityFile
  • Specifying git.path in VS Code to C:/Program Files/Git/cmd/git.exe and C:\Program Files\Git\bin\git.exe (and validated that VS Code was using htem in the Git Output
  • Reinstalling Git for Windows and using Pageant/Plink for SSH (but I've reinstalled again and gone to OpenSSH)
  • Probably other things

Nothing seems to work. :(

1 Answers

To use a passphrase protected key in a non interactive session (e.g : git fetch run by VS Code), you would need to set up an ssh-agent, and check that VS Code is started with the correct environment to access that agent.

Related