我创建了我的 .gitignore
并列出了我创建的新文件,但是当我运行 git添加时,Git仍然将它们添加。
在搜索解决方案时,我看到了很多我的类似问题,但是对于每个问题,人们在运行 git add add。
命令后创建了 .gitignore
,并且使用删除的缓存文件方法解决了该问题( git rm - cached。
),但这对我不起作用,因为在创建 .gitignore
文件之前,从未添加过这些文件。
.gitignore是我的工作目录的根源,看起来像这样:
db.sqlite3
.idea/
venv/
media/
就是我运行 git add。
On branch main
new file: .idea/vcs.xml
new file: .idea/workspace.xml
new file: db.sqlite3
new file: media/Test.jpg
new file: media/TestProfilePict.jpg
这 它不起作用吗?
I created my .gitignore
and listed the new files I created, but git still add them when I run my git add .
While searching for a solution, I saw a lot of similar question of mine, but for each question people created the .gitignore
after running the git add .
command, and the problem was solved with the removing cached files method (git rm --cached .
), but that didn't work for me since those files were never added before the creation of the .gitignore
files.
The .gitignore is at the root of my working directory, and looks like that :
db.sqlite3
.idea/
venv/
media/
And this is what I get when i run git add .
and git status
:
On branch main
new file: .idea/vcs.xml
new file: .idea/workspace.xml
new file: db.sqlite3
new file: media/Test.jpg
new file: media/TestProfilePict.jpg
Any idea why it's not working?
发布评论