TransWikia.com

Why is gitignore not working even after i put the file name in?

Stack Overflow Asked by sonika on December 7, 2021

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?

5 Answers

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

Answered by Ericgit on December 7, 2021

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

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

Answered by Thiago Lopes on December 7, 2021

gitignore is file, remove .txt from file name

.gitignore.txt -> .gitignore

Answered by RahulN on December 7, 2021

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.

Answered by dave on December 7, 2021

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

Answered by Anton Belev on December 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP