Remove a file form history Exclude the from in gitignore Remove the file from history: git filter-branch --tree-filter 'rm -f /path/to/sensitive/file' HEAD Update the history to remote: git push origin --force --all