0

I have a file called sohuku.txt. I have another folder named .gitignore.txt inside which I have put 'sohuku.txt', but when I type 'git add .' in PowerShell and then type git status, it shows the file in changes to be committed. what to do?

ceving
  • 21,900
  • 13
  • 104
  • 178
sonika
  • 239
  • 1
  • 2
  • 9

5 Answers5

2

The .gitignore file should be at the root of the repository and named properly. https://git-scm.com/docs/gitignore

Anton Belev
  • 11,963
  • 22
  • 70
  • 111
2

The file has to be named .gitignore, not .gitignore.txt

If windows won't let you rename it (an error like "you must type a filename"), then rename it to .gitignore.

dave
  • 62,300
  • 5
  • 72
  • 93
2

gitignore is file, remove .txt from file name

.gitignore.txt -> .gitignore

RahulN
  • 218
  • 1
  • 5
2

Don't put .txt on the .gitignore file...

So you can pass the file name that you don't want to push to git.

LightCC
  • 9,804
  • 5
  • 52
  • 92
1

create .gitignore file in your root / directory without any extension.

/
  src
     index.js
  .gitignore

want to remove the .txt files, just add in the .gitignore file

*.txt

and remove the old commit:

$ git reset HEAD~                                          
<< edit files as necessary >>                              
$ git add ...                                              
$ git commit -c ORIG_HEAD

Undo git to learn more

Ericgit
  • 6,089
  • 2
  • 42
  • 53