git delete files containing sensitive information has been submitted (not submitted to a remote repository)

Written code has been submitted (but not push to github), I found a file containing the password. If you push it, the password may be disclosed. If you get rid of the password in the code, and then commit again, does not work, historical records or submitted will be uploaded to github, people will still see.
How to do, run the following two commands can be removed from the file of just submit.
 
git rm --cached file name
git commit --amend -CHEAD
 
After the run, the file becomes a workspace state, other modifications, or is it just submit photos submitted.
You can now rest assured that push up.
This document, we slightly modified or added later gitignore, and then continue to commit ok. .

Guess you like

Origin www.cnblogs.com/yasw/p/11016642.html