Skip to content

Commit

Permalink
Update git-repository.md (#1430)
Browse files Browse the repository at this point in the history
Update instructions on how to scan private git repositories, as according to aquasecurity/fanal#253 .
  • Loading branch information
macedogm committed Dec 6, 2021
1 parent 6e35b8f commit 3ae4de5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions docs/vulnerability/scanning/git-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Scan your remote git repository
$ trivy repo https://github.com/knqyf263/trivy-ci-test
```

Only public repositories are supported.

<details>
<summary>Result</summary>

Expand Down Expand Up @@ -148,3 +146,20 @@ Total: 20 (UNKNOWN: 3, LOW: 0, MEDIUM: 7, HIGH: 5, CRITICAL: 5)
```

</details>

## Scanning Private Repositories

In order to scan private GitHub or GitLab repositories, the environment variable `GITHUB_TOKEN` or `GITLAB_TOKEN` must be set, respectively, with a valid token that has access to the private repository being scanned.

The `GITHUB_TOKEN` environment variable will take precedence over `GITLAB_TOKEN`, so if a private GitLab repository will be scanned, then `GITHUB_TOKEN` must be unset.

For example:

```
$ export GITHUB_TOKEN="your_private_github_token"
$ trivy repo <your private GitHub repo URL>
$
$ # or
$ export GITLAB_TOKEN="your_private_gitlab_token"
$ trivy repo <your private GitLab repo URL>
```

0 comments on commit 3ae4de5

Please sign in to comment.