Sonar scanner fails on gitea server

Hi. I’m implementing a post-receive git hook on gitea server side. It’s a sonar-scanner command that executes in a bash script, that updates the SonarQube server everytime somebody pushes to the repo.

SonarQube Scanner 4.2.0.1873

What I’m interesting in, is the following error I get when I manually execute sonar-scanner (that’s to see if I have communication with SonarQube server):

ERROR: Error during SonarQube Scanner execution
org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
at org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1569)

so the path where I execute sonar-scanner is /home/git/gitea-repositories/user/project.git (that’s standard location for gitea repos)
What I only understand is that the git project folder is not suitable for sonar-scanner somehow on gitea server. I didn’t reproduce the same behavior on another host, where I successfully execute sonar-scanner.

Hi,

Welcome to the community!

You need to either disable SCM blame retrieval or run the scanner from the project root directory (side-by-side with the .git directory).

 
HTH,
Ann