git config - Unable to find .gitconfig in old Git commits -
I have seen a moment ago that my .gitconfig -file was public in my reps Includes my secret tokens.
I commit git-add -u
and file. I'm not sure whether this command removes the file from the previous command or not.
I am sure the file is to be searched in my previous commitment, as if there is no such file in my history.
How can you find the file in the previous command?
I run
git filter-branch - tree-filter 'rm .gitconfig' Master # Thank you for Greg!
I get
rewrite 84dabfa2ea195ce9aad0309216858b302150017c (1/25) rm: .gitconfig: Failure to filter any such file or directory tree: rm .gitconfig
I have been notified of the error message that I have no file on Commit History.
Is the file to search in my commute history? To do this I do not have to run the removal to see that I do not have a file in my history?
Short answer:
git Filter-branch --tree-filter 'rm -f .gitconfig' Master
note -f
.
Long answer:
rm
will return a non-zero return code when the file does not exist Filter- Branch
seems to be an error and stop typing again. Avoid adding -f
to it.
Note:
An optional command is:
GIT filter-branch - index-filter 'git rm - -cached --ignore-unmatch .gitconfig 'master
which is very fast This document is documented in the EXAMPLE section of the man page.
Comments
Post a Comment