该文件夹当前打开

发布于 2025-01-22 05:41:50 字数 590 浏览 1 评论 0 原文

我正在使用具有Windows操作系统的工作PC,并且习惯于使用Ubuntu OS进行铁轨开发。 我在vscode和windows上的git上使用wsl和ubuntu正确安装了所有内容,但问题是源控制面板没有检测到任何东西,它只是显示了以下内容:

”源控制面板的屏幕快照在VS代码中”

我该如何解决?

这是我的安装参考。

  • 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

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:

Screenshot of Source Control Panel in VS Code.

How can I resolve this?

Here's my installation references.

  • Visual Studio Code
    https://code.visualstudio.com/
  • WSL https://learn.microsoft.com/en-us/windows/wsl/install
  • Git https://git-scm.com/download/win

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

逆蝶 2025-01-29 05:41:50

您需要使用推荐命令添加回购目录作为安全目录:

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

您还可以信任任何目录(但不是真正建议),

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

如果您遇到这样的错误:

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

请查看 27073427 答案

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

情绪 2025-01-29 05:41:50

更改可能来自 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.

只是偏爱你 2025-01-29 05:41:50

@Twege解决方案对我有用。我关闭了,然后重新打开了新的远程开发容器,然后Vscode识别了我检查的分支。

配置:
Windows 11; WSL2; vscode;远程容器开发,带有docker-indocker; Github与分支相关的问题;

步骤:

  1. gitHub:创建了使用readme.md github创建的github存储库
  2. :在本地vscode Machine上设置.DEVCONTAINER的添加
  3. 问题
    创建此分支后出现的两个命令[git提取
    起源; git Checkout [新分支名称]]
  4. VSCODE:克隆远程存储库到我的本地驱动器,该存储库在VSCODE VSCODE中打开它
  5. :添加了“开发容器配置文件”(对于Python 3,我添加了Git,SSH Server;和Docker-In-in-indocker;和Docker-In-in-indocker )
  6. vscode:edit .devcontainer json和docker文件(fx,向前端口到本地计算机)
  7. git(在vscode终端中 - 注意您仍然在Windows或wsl2主机Linux中):添加,提交和推送到Origin asem )
  8. git:git将提示您存储库由SomeOnelse拥有,因此并向您介绍该命令以运行:( git config - global -add safe.directory'path/path/to/repo')
  9. vscode:'在容器中打开'
  10. git(在新的远程容器中):现在使用在GITHUP中创建新分支时收到的两个命令
  11. :[git fet fort oince; Git Checkout [新分支名称]]
  12. VSCODE:关闭远程连接VSCODE:重新启动本地VSCODE
  13. VSCODE:打开您刚创建的新远程容器。

现在,您应该查看已签出的新分支的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:

  1. Github: Created github repository with README.md
  2. Github: Added issue for setting up .devcontainers on local vscode machine
  3. Github: Created branch associated to .devcontainer issue (remember to copy
    the two commands presented after creating this branch [git fetch
    origin; git checkout [new branch name]]
  4. VSCode: Cloned remote repository to my local drive, which opened it in VSCode
  5. VSCode: Added 'Development Container Configuration Files' (for Python 3, I added Git, SSH server; and docker-in-docker)
  6. VSCode: Edit .devcontainer json and Docker files (fx, forward ports to local machine)
  7. Git (in vscode terminal - note you are still in windows or wsl2 host linux): add, commit and push to origin all changes (.devcontainer files)
  8. Git: git will prompt you the repository is owned by someonelse, so and present you with this command to run: (git config --global --add safe.directory 'path/to/repo')
  9. VSCode: 'Open in Container'
  10. Git (in new remote container): now use the two commands you received when you created the new branch in
  11. Githup: [git fetch origin; git checkout [new branch name]]
  12. VSCode: Close Remote Connection VSCode: restart local VSCode
  13. VSCode: Open new remote container you just created.

Now you should see the your git information for the new branch checked out.

倚栏听风 2025-01-29 05:41:50

如果您使用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.

一身软味 2025-01-29 05:41:50

1对于Windows,打开 c:\ users \ yourusername \ .gitConfig

2 2在[SAFE]部分中添加您的项目路径,示例:

[safe]
  directory = D:/path/to/your-project

3重新启动VSCODE

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

蓝颜夕 2025-01-29 05:41:50

我在远程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.

九厘米的零° 2025-01-29 05:41:50

它可能是从某个框架中开始初始化的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

放低过去 2025-01-29 05:41:50

遇到了同样的问题,我只是用vscode作为管理员运行了

Had the same issue, I just ran the vscode as admin and it worked

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文