该文件夹当前打开
我正在使用具有Windows操作系统的工作PC,并且习惯于使用Ubuntu OS进行铁轨开发。 我在vscode和windows上的git上使用wsl和ubuntu正确安装了所有内容,但问题是源控制面板没有检测到任何东西,它只是显示了以下内容:
。
我该如何解决?
这是我的安装参考。
- Visual Studio代码
https://code.visualstudio.com/
- wsl
https://learn.microsoft.com/en-us/windows/windows/wscl/wsl/wsl/install/install
- git
git
https:https:https:https:https:https:https:https:https:https:https: //git-scm.com/download/win
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您需要使用推荐命令添加回购目录作为安全目录:
您还可以信任任何目录(但不是真正建议),
如果您遇到这样的错误:
请查看 27073427 答案
You need to add the repo directory as a safe directory with the recommended command:
you can also trust any directory (But it is not really recommended)
if you face an error like this:
please look at 27073427 answer
更改可能来自 git安全更新。
.git文件夹的所有者与您正在运行的VS代码的用户不同,因此存储库不会在VS代码中显示。
您可以按以下方式更改窗口中的权限:
右键单击文件夹 - >属性 - >安全 - >高级
您可以更改所有者或添加另一个用户。
更改权限后,您必须重新启动VS代码。
现在,所有存储库都应再次显示。
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解决方案对我有用。我关闭了,然后重新打开了新的远程开发容器,然后Vscode识别了我检查的分支。
配置:
Windows 11; WSL2; vscode;远程容器开发,带有docker-indocker; Github与分支相关的问题;
步骤:
创建此分支后出现的两个命令[git提取
起源; git Checkout [新分支名称]]
现在,您应该查看已签出的新分支的GIT信息。
@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:
the two commands presented after creating this branch [git fetch
origin; git checkout [new branch name]]
Now you should see the your git information for the new branch checked out.
如果您使用Mac这可能会有所帮助 -
在本地用户目录中打开您的.bash_profile,然后添加路径
“/usr/local/bin/git”。您可以在VI中打开.bash_profile,并键入路径=“/usr/local/bin/git”并保存。
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.
1对于Windows,打开
c:\ users \ yourusername \ .gitConfig
2 2在[SAFE]部分中添加您的项目路径,示例:
3重新启动VSCODE
1 For windows, open
C:\Users\yourusername\.gitconfig
2 Add your project path in the [safe] section, example:
3 Restart VSCode
我在远程Linux服务器上工作,并且遇到了同样的问题。我删除了本地'.vscode-server'(例如rm -rf/home/ [user ]/.vscode-server),让VS代码在下次重新连接时进行重新启动。
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.
它可能是从某个框架中开始初始化的git,而您根本看不到它,而且运行bash命令通常不起作用。
从项目级别的PowerShell开始,只需运行以下操作:
Get -Childitem-force
这将使可见文件夹
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
遇到了同样的问题,我只是用vscode作为管理员运行了
Had the same issue, I just ran the vscode as admin and it worked