为什么 git 跟踪我桌面上的所有新文件?

Why git track all my new files on my Desktop?

我有一个 "problem",当我在桌面上创建(或下载)任何 folder/file 时,Git 那个曲目? 这是为什么?

这正常吗?

O.S. Windows 10

Git version: latest at this moment

好吧,当我打开我的 VS 代码时,代码建议我提交更改。这就是我的问题,因为我有数千个 git 跟踪的文件。

我认为你在桌面或包含桌面文件夹的 C 驱动器上创建了 repo

C:\Users\username\Desktop

来自

git init

请通过

检查其状态
git status

因此请检查包含桌面文件夹的任何文件夹中的 .git 文件并将其删除。

要查看 Windows 中的隐藏文件,请参阅 Show hidden files

您已经从您的桌面创建了一个 git 存储库。

为了取消它,请删除 .git 文件夹,然后为您的代码创建一个新文件夹并执行:

# Change to the required directory (or use windows explorer)
cd <folder name>

如果您使用的是git bash您可以右键单击该文件夹并执行git-bash以获取CLI命令行(终端)

# init the git repository in the desired folder
git init 

如果您正在进行实际项目,请前往 https://gitignore.io 并获取您的 .gitignore。复制内容并将其放入新创建的文件夹

中的 .gitignore 文件中