If you haven’t setup GitGuardian workspace and GGshield installation , Please go through the below post and follow the steps 1-9 for GG Shield setup
- Type – 1 : Scan your local git repository.
- Type – 2 : Scan the repository for secrets and export the incidents and secrets to a JSON file.
- Type – 3 : Scan the remote repository for secrets without cloning into your local.
- Type – 4 : Scan the particular path recursively for the secrets inside your repository.
- Type – 5 : Scan the particular file in your repository for secrets
Type – 1 : Scan your local git repository
Step – 1 : Navigate to the root folder of your git repository and open GitBash.
Step -2 – Execute the below command to run the scan for the given repository
ggshield scan repo .
Here in the above scan, it scans through all of the commits and provide the secrets and occurences available in the repository including the history
So by finding the files showing in the above terminal one can go individually for each file through commit id or file path and can proceed with the plan of removing the traces.
Okay so what if you want to export the incidents and secrets explicitly into a file, so that you can solve the incidents one by one. In that case use the below type.
Type – 2 – Scan the repository for secrets and export the incidents and secrets to a JSON file.
Execute the below command in your project root folder.
ggshield scan --show-secrets --json --output D:\\secrets.json repo .
Type – 3 : Scan the remote repository for secrets without cloning into your local
ggshield scan --show-secrets --json --output D:\\all.json repo https://github.com/vigneshram20/SecretsRemovalTest.git
Type – 4 : Scan the particular path recursively for the secrets inside your repository
ggshield scan path GitGuardianDemo/src/ --recursive
Type – 5 : Scan the particular file in your repository for secrets
ggshield scan path GitGuardianDemo/src/ClassWithSecrets.java