Install and use Gitleaks for WSL2 or Linux

gitleaks git linux window 11

5 minute read

Gitleaks to check and prevent leaked the sensitive information like: token, password, ...

1. Download Gitleaks from github

$ wget https://github.com/gitleaks/gitleaks/releases/download/v8.21.2/gitleaks_8.21.2_linux_x64.tar.gz

You can get more version and type file to install in link

install prettier extension for vs code

Notes: arm file is for mobile device not for PC or server

2. Extract the folder which we have just downloaded

$ tar -xzf gitleaks_8.21.2_linux_x64.tar.gz

3. Move the extracted file into /usr/local/bin/ folder

$ sudo mv gitleaks /usr/local/bin/

4. Make the Binary Executable

$ sudo chmod +x /usr/local/bin/gitleaks

5. Verify the installation

$ gitleaks version

Notes: Maybe you need to close terminal and reopen again

6. Run Gitleaks commands

For checking

$ gitleaks detect --source .

For checking and show results

$ gitleaks detect --source . --report-path=gitleaks-report.json