Remove sensitive files and their commits from Git history

前端 未结 11 2183
借酒劲吻你
借酒劲吻你 2020-11-21 04:36

I would like to put a Git project on GitHub but it contains certain files with sensitive data (usernames and passwords, like /config/deploy.rb for capistrano).

I kno

11条回答
  •  情深已故
    2020-11-21 05:16

    In my android project I had admob_keys.xml as separated xml file in app/src/main/res/values/ folder. To remove this sensitive file I used below script and worked perfectly.

    git filter-branch --force --index-filter \
    'git rm --cached --ignore-unmatch  app/src/main/res/values/admob_keys.xml' \
    --prune-empty --tag-name-filter cat -- --all
    

提交回复
热议问题