Loading [MathJax]/jax/output/HTML-CSS/jax.js

Saturday, December 12, 2020

Remove Sensitive Environment Variable / File That is too Big from Remote Repo

In case mistakenly pushed a large file/sensitive environment data and git rm --cached does not help (pushed to the remote repo but just untracked locally):
1
2
3
git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch <path to your file>" \
  --prune-empty --tag-name-filter cat -- --all
(cd to the top level of the repo first), add -r flag if you want to remove the whole directory. REF: 

https://docs.github.com/.../removing-sensitive-data-from... 

This error may subsequently follow: fatal: refusing to merge unrelated histories Then
1
git pull origin the-remote-branch --allow-unrelated-histories
and resolve conflicts.

No comments:

Post a Comment