安装Tailsman-密钥检查工具
·
Peanuts
Install Tailsman to protect token/secret
Installation
First run follow command to install tailsman as a pre-commit hook
curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/master/global_install_scripts/install.bash > /tmp/install_talisman.bash && /bin/bash /tmp/install_talisman.bash
after tailsman binary has been downloaded, you will encounter following extra question:
PLEASE CHOOSE WHERE YOU WISH TO SET TALISMAN_HOME VARIABLE AND talisman binary PATH (Enter option number):
# choose `4) I will set it later`
Git template directory: (/Users/username/.git-template)
# just press enter to use default location
Please enter root directory to search for git repos (Default: /Users/username):
# then you will receive a error that it can't be hooked up as pre-commit
# and just ignore it!
Setup Environment Variable
add following to your shell profile, for example: ~/.zshrc
# >>> talisman >>>
# Below environment variables should not be modified unless you know what you are doing
export TALISMAN_HOME=~/.talisman/bin
alias talisman=$TALISMAN_HOME/talisman_darwin_amd64
export TALISMAN_INTERACTIVE=true
# <<< talisman <<<
then make it ready, besides you need restart your IDE or other:
source ~/.zshrc
Pre-commit chain with husky
make sure has such code in package.json
...
"husky": {
"hooks": {
"pre-commit": "$TALISMAN_HOME/talisman_hook_script pre-commit && lint-staged",
"pre-push": "npm run test:unit"
}
},
...
Ok, all done :)