LoginSignup
2

More than 5 years have passed since last update.

Ubuntuにgit-secretsを導入する

Posted at

目的

数十番煎じだが、備忘録のためgit-secretsのインストール手順を記載する。

やったこと

git-secretsをインストール

git clone https://github.com/awslabs/git-secrets.git
cd git-secrets
sudo checkinstall

全体にgit-secretsを適用

AWSトークンに関するルールセットを導入

git secrets --register-aws --global

git initしたときなどのデフォルト

cp -r /usr/share/git-core/templates ~/.git_templates
mkdir ~/tmp_git-secrets
cd ~/tmp_git-secrets
git init
git secrets --install
cat .git/hooks/commit-msg >> ~/.git_templates/hooks/commit-msg
cat .git/hooks/pre-commit >> ~/.git_templates/hooks/pre-commit
cat .git/hooks/prepare-commit-msg >> ~/.git_templates/hooks/prepare-commit-msg
cp ~/.gitconfig ~/.gitconfig.bak
echo '\n[init]\n    templatedir = ~/.git_templates' >>  ~/.gitconfig

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2