1. Open Your Terminal or Command Prompt
cd path/to/your/repository
2. Remove the File Using Git
git rm path/to/your/file
For example, if you want to delete a file named old-file.txt in a directory called docs, you would run:
git rm docs/old-file.txt
3. Commit the Changes
git commit -m "Remove file path/to/your/file"
4. Push the Changes to a Remote Repository
git push