LoginSignup
4
2

More than 3 years have passed since last update.

Windowsにgit-secretsをインストール

Last updated at Posted at 2020-12-03

概要

アプリケーションをAWSと連携するにあたり、万が一色々なキーがgithubに上がったら・・・と震えが止まらないのでgit-secretsを導入。

導入方法

公式リポジトリからクローンしましょう。

PS: cd どこかのフォルダ
PS: git clone https://github.com/awslabs/git-secrets.git

クローンが終わり次第、公式の手順に従い、PowerShellスクリプトを実行します。

エラー発生

公式に記載されているスクリプトを実行したが、エラーが発生。

PS: C:どこか\git-secrets> ./install.ps1
.\install.ps1 : このシステムではスクリプトの実行が無効になっているため、ファイル C:どこか\git-s
ecrets\install.ps1 を読み込むことができません。詳細については、「about_Execution_Policies」(https://go.
microsoft.com/fwlink/?LinkID=135170) を参照してください。
発生場所 行:1 文字:1
+ .\install.ps1
+ ~~~~~~~~~~~~~
    + CategoryInfo          : セキュリティ エラー: (: ) []、PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

原因はこちらの記事に記載されているものと同じようです。

PowerShellの初期設定ではスクリプトが実行できないんですね。

PS C:どこか\git-secrets> PowerShell Get-ExecutionPolicy
Restricted

今後もPowerShellスクリプトを使う機会はあると思いますので、私の場合は恒久設定をしました。

PS C:どこか\git-secrets> PowerShell Set-ExecutionPolicy RemoteSigned

再度実行

PS C:どこか\git-secrets> ./install.ps1
Checking to see if installation directory already exists...
Creating installation directory.
Copying files.
Checking if directory already exists in Path...
Adding to path.
Adding to user session.
Done.

これで完了です。

4
2
0

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
4
2