使用git filter-branch删除的文件在推送和拉回后重新出现

时间:2015-06-12 07:44:00

标签: git gitlab git-filter-branch

我在存储库中有一些敏感信息。试图消毒它,然后推送到GitLab。然而,一旦从GitLab撤出,清理后的信息就会重新出现。我的错误在哪里?

git log -Smypassword

<returns some commits showing that mypassword is indeed in the repo>

# clean the repo from mypassword
git filter-branch -f --tree-filter "find . -name '*.js' -exec sed -i -e 's/mypassword/nomorepassword/g' {} \;"^C

git log -Smypassword
<nothing found, indicating that git filter-branch worked>

git remote add origin git@gitlab.com:user/project.git

# I have two unmerged branches
git push -u origin master
git push -u origin accounts

cd ../fresh

git clone  git@gitlab.com:user/project.git

git log -Smypassword

<returns some commits again> 

我做错了什么?

1 个答案:

答案 0 :(得分:1)

我将另一个分支合并为master并重新编写它。现在工作。不能告诉我这是一个错误,还是两个分支与它有关。