Git Remove Remote File and Stop Syncing
Accidentally uploaded the db.sqlite3 file in a Django project. Follow these steps to fix this:
- Remove the file from staging area (index), but keep the file in working directory
git rm --cached ./proj/db.sqlite3- Check file status. You will see the file marked as "deleted" (in staging area) and "untracked" (in working directory)
git status
# Sample output
# On branch master
# Your branch is up to date with 'origin/master'.
# Changes to be committed:
# (use "git restore --staged <file>..." to unstage)
# deleted: proj/db.sqlite3- Commit this delete operation. From now on, Git will no longer track this file, but your local file remains.
git commit -m "remove db.sqlite3"- Important! Add this file to .gitignore
# db.sqlite3
db.sqlite3