VS 代码源代码控制填充了 Mac 上我的用户文件夹中的所有文件(代码和 zip 文件) [英] VS code source control populates with all the files (code and zip files) from my User folder on Mac

查看:31
本文介绍了VS 代码源代码控制填充了 Mac 上我的用户文件夹中的所有文件(代码和 zip 文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我的 VScode,源代码控制选项卡显示 5K 文件已更改(未声明的提交).我跑了

At the moment my VScode, source control tab shows 5K file changed (unstated commits). I ran

git rev-parse --show-toplevel

和打印

/User/myName

所以我去了那个有 git 文件夹的位置,但它只包含我之前使用 HTTPS 克隆的 2 个以前的项目.

so I go that location where I have a git folder but it only contains 2 of my previous projects I cloned from before hand with HTTPS.

打开一个新的 vscode 窗口也不起作用,而且 vs code 是最新的.

Opening a new vscode window doesn't work either and vs code is up to date.

推荐答案

看起来你的主目录是一个 Git 存储库.Git 会尝试查找目录层次结构,直到找到 .git 目录,并且在它找到的第一个位置,它会认为是它的存储库.

It looks like your home directory is a Git repository. Git will try to look up the directory hierarchy until it finds a .git directory, and the first place it finds one, it will consider that its repository.

如果您不希望 Visual Studio Code 将项目的存储库视为您的项目的存储库,那么您需要禁用您正在处理的内容的源代码控制功能,或者通过运行 git init 在您项目的顶级目录中(并且可能会重新启动 VS Code).一旦 Git 看到新的存储库,它就不会再递归到您的主文件夹.

If you don't want Visual Studio Code to consider that the repository for your project, then you either need to disable the source control functionality for what you're working on, or create a repository for your project by running git init in the top-level directory of your project (and possibly restarting VS Code). Once Git sees the new repository, it won't recurse up to your home folder anymore.

或者,您也可以不将主目录作为存储库.如果您使用 Git 管理您的点文件,您可以使用脚本将它们从存储库复制到您的主目录中,而不是将您的主目录作为存储库.

As an alternative, you could also not have your home directory be a repository. If you manage your dotfiles using Git, you could have a script to copy them from the repository into your home directory instead of having your home directory as a repository.

这篇关于VS 代码源代码控制填充了 Mac 上我的用户文件夹中的所有文件(代码和 zip 文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆