Prerequisite:
Git must be configured in windows OS.
Clone awslabs/git-secrets repo using git-bash
Follow the below document to configure git-secrets globally…
- Update your git using git-bash. Execute the following command on git-bash.
git update-git-for-windows2. Clone the repo
Command:
git clone https://github.com/awslabs/git-secrets.git2. open PowerShell “run as administrator”
go to the repository where we clone the above repo. In my case path is
C:\users\dell\desktop\ttn\git-secrets3. Check the version of the git.
git --version4. Now execute the installation script of the windows. It simplifies the setup on windows.
./install.ps1This might show an error like :
./install.ps1 : File C:\Users\Dell\desktop\ttn\git-secrets\install.ps1 cannot be loaded because running scripts is disabled on this system.
This is because the current PowerShell policy is restricted we can unrestricted it using the following command.
Set-ExecutionPolicy RemoteSignedBelow is the list of four different execution policies in PowerShell
- Restricted — No scripts can be run.
- AllSigned — Only scripts signed by a trusted publisher can be run.
- RemoteSigned — Downloaded scripts must be signed by a trusted publisher.
- Unrestricted — All Windows PowerShell scripts can be run.
5. Download the git-secrets.
git secrets --install6. To add hooks to all the local repositories.
git secrets --install ~/.git-templates/git-secrets
git config --global init.templateDir ~/.git-templates/git-secrets7. To add hooks to all repositories if we initialize or clone in the future.
git secrets --register-aws --global