Yelp/detect-secrets

Doesn't work in mirrorred repositories

Opened this issue · 4 comments

When trying to scan a git repository checked out using git clone --mirror, detect-secrets fails with an error:

fatal: this operation must be run in a work tree

To duplicate, try the following:

git clone --mirror https://github.com/Yelp/detect-secrets.git
cd detect-secrets.git/
detect-secrets scan

@nightwatchcyber Hello. Can you post some information regarding your environment setup? OS, detect-secrets version for example? I tried this on a Linux system and it seemed to work fine. V1.2.0 of detect-secrets

Running v1.2.0 on MacOS 12.4

Hi @nightwatchcyber, is this issue still a concern?

It's still a problem, just tried with detect-secrets v1.5.0 on MacOS 14.4.1:

The mirrored repository finds nothing:

git clone --mirror https://github.com/Yelp/detect-secrets.git
cd detect-secrets.git/
detect-secrets scan

Regular one finds secrets:

git clone https://github.com/Yelp/detect-secrets.git
cd detect-secrets.git/
detect-secrets scan