Search code examples
gitgithubgitignore

How to remove a file in the github repository to add the file to .gitignore?


I added a yarn-error.log file to my github repository and tried to add it to .gitignore but it remains in the repository ... How do I uncommit this


Solution

  • If you try to delete this file with a .gitignore you will not delete it.

    When you upload a file to github the file will always be there. That's so because git needs to store all the files that you have uploaded, so it can retain all the information and records that have been made.

    If you want delete the file, go to github and delete it directly with the webpage and make a commit.

    After this make a git pull and then you could add the file yarn-error.log to .gitignore