Pre-commit hook gives ERROR This CLI is only available with a SonarQube Server license or a So

Must-share information (formatted with Markdown):

  • Sonar Enterprise edition
  • Pre-commit hook secret detection
  • installed sonar.py and added secret and token to environment variables as per the documentation.

Errror message:

ERROR Failed to parse authentication response
ERROR This CLI is only available with a SonarQube Server license or a SonarQube Cloud account.
ERROR Update your token in the ‘SONAR_SECRETS_TOKEN’ environment variable. Please create a new token at [My_organization]

Hello,

From what you described, it should work.

Did you configure your SonarQube Server URL using SONAR_SECRETS_AUTH_URL env variable?

Anyway, we are about to release an update of the SonarQube CLI that will take in charge the installation of the pre-commt hook with a better authentication mechanism (it will open your SonarQube Server in a browser for you).

Regards
Alex