2

I am working on a work PC which has a windows OS and I'm used to using ubuntu OS for rails development. I installed everything properly with wsl as ubuntu on VSCode and git for windows but the problem is the source control panel is not detecting anything and it just shows this. How to resolve this?

Here's my installation references.

  • Visual Studio Code https://code.visualstudio.com/
  • WSL https://docs.microsoft.com/en-us/windows/wsl/install
  • Git https://git-scm.com/download/win
JM Arenas
  • 21
  • 4
  • Which folder have you opened in VS Code and does it actually have a `.git` folder inside? – carlfriedrich Apr 19 '22 at 08:44
  • I opened the repo folder which I had cloned earlier and yes it does have `.git` folder inside – JM Arenas Apr 20 '22 at 03:28
  • Hmm... Maybe you can add some more details to your question. Does VS Code's explorer show the folder correctly? Where and how did you clone the repository? Are you using VS Code in remote mode connected to WSL? Maybe add a screenshot of your complete VS Code window. – carlfriedrich Apr 20 '22 at 07:29

2 Answers2

1

The change probably came from the GIT security update.

The owner of the .git folder is not the same user you are running VS Code with, so the repo will not show up in VS Code.

You can change the permissions in Window as follows:

Right-click folder -> Properties -> Security -> Advanced

Here you can change the owner or add another user.

After changing the permissions, you have to restart VS Code. Now all repos should be displayed again.

TWege
  • 11
  • 1
0

You need to add the repo directory as a safe directory with the recommended command:

git config --global --add safe.directory 'path/to/repo'

you can also trust any directory (But it is not really recommended)

git config --global --add safe.directory *

if you face an error like this:

error "fatal: bad config file line 1 in .git/config" 

please look at 27073427 answer

Hadi Masoumi
  • 444
  • 4
  • 8