J
J
jeruthadam2017-09-06 15:13:13
git
jeruthadam, 2017-09-06 15:13:13

How to remove a file from git and move it to .gitignore?

Accidentally committed and pushed a file with a secret. Now I added it to .gitignore, but it's not clear how to remove it from the git itself and the remote repository?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2017-09-06
@jeruthadam

git rm --cache <file>
git commit -m 'no one should see my secret'
git push

only in the history of commits it will remain - you have to look for how to remove it from there as well.
It's better to change anyway, if possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question