My .gitignore doesn't work

Problem: files from .gitignore are pushed to github


  • created new repo on github from my repl
  • created .gitignore via shell in repl
  • added into .gitignore
  • executed in shell from root
git add .
git comit -m 'some commit'
git push

Expected result: no file
Got result: all the files are on github

appreciate any help

Hey, @amikhailovskaia welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

Git will still track and include them in the repository. The .gitignore file only affects files that are untracked at the time the file is added to the ignore list

try these commands

git rm --cached
git commit -m "Remove files from Git tracking"
git push

replace “Remove files from Git tracking” with the actual files, well its a commit message so adjust it as you deem helpful

1 Like

It was really helpful,
thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.