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

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(

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.


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).