Reputation: 111
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 can I resolve this?
Here's my installation references.
https://code.visualstudio.com/
https://learn.microsoft.com/en-us/windows/wsl/install
https://git-scm.com/download/win
Upvotes: 11
Views: 18747
Reputation: 1928
It could be the git is already initialized as from some framework and you simply do not see it, also running usually bash command does not work.
From powershell at the project level, simply run this:
Get-ChildItem -Force
This will make visible .git folder
Upvotes: 0
Reputation: 1
I worked on a remote linux server and had the same problems. I removed the local '.vscode-server' (e.g. rm -rf /home/[user]/.vscode-server) and let VS Code do a reinitialisation the next time I reconnect.
Upvotes: 0
Reputation: 2740
1 For windows, open C:\Users\yourusername\.gitconfig
2 Add your project path in the [safe] section, example:
[safe]
directory = D:/path/to/your-project
3 Restart VSCode
Upvotes: 0
Reputation: 764
Had the same issue, I just ran the vscode as admin and it worked
Upvotes: -2
Reputation: 1
If you are using mac this might help-- Open your .bash_profile in your local user directory and then add the path "/usr/local/bin/git". You can open .bash_profile in vi and type PATH="/usr/local/bin/git" and save.
Upvotes: 0
Reputation: 13
@TWege solution worked for me. I closed then reopened the new remote dev container and then VSCode recognized the branch I checked out.
configuration: Windows 11; WSL2; VSCode; Remote Container Developement w/ Docker-in-Docker; Github with issue associated to branch;
Steps:
Now you should see the your git information for the new branch checked out.
Upvotes: 0
Reputation: 1396
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
Upvotes: 18
Reputation: 61
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.
Upvotes: 6