简体   繁体   中英

How to properly ignore files from git using .gitignore file?

My assignment is requiring me to ignore two folders from git along with their contents. I have created a .gitignore.txt file and typed in the folders' names in the file:

在此处输入图片说明

I have also tried the above with a /* at end of file names and without any forward slash or asterisk at all. However, git seems to still recognize these folders. Here is the result I receive each time I use git status command in git-bash.

在此处输入图片说明

git is still recognizing these folders since they are within the untracked files, correct? What do I need to do to have git ignore the folders completely?

你有错误的文件名 - 它应该只是.gitignore ,没有扩展名,而不是.gitignore.txt

You've created a file called .gitignore.txt , which is not special to Git in any way. The file must be called exactly .gitignore , with no extension.

Many Windows programs automatically append a file extension, and Notepad is no different. You're going to be a little better off using a slightly more capable text editor. There are many; any one is fine.

In the mean time, you can quit Notepad, then do mv .gitignore.txt .gitignore and things should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM