This is an archived version of the documentation for SonarQube-6.7.
See the Latest Documentation for current functionality.

Git Plugin

By SonarSource – GNU LGPL 3 – Issue TrackerSources – Supported by SonarSource
More versionsFewer versions
Git 1.8 – Mar 20, 2019 – SonarQube 6.7+ (Compatible with LTS)
Add automatic exclusions based on .gitignore
DownloadRelease notesGit 1.7 – Jan 21, 2019
Update JGit, add warning in PR analysis, improve detection of changed lines
Release notesGit 1.6 – Oct 29, 2018
Register analysis warning when shallow clone is detected
Release notesGit 1.5 – Oct 29, 2018
Correct detection of "new" files in PR, Branch analysis
Release notesGit 1.4.1 – May 23, 2017
Bug fix for short-lived branches and P/R analyses
Release notesGit 1.4 – Mar 16, 2018
Minor improvements, prepare support for P/R analysis
Release notesGit 1.3 – Oct 20, 2017
Support of branches
Release notesGit 1.2 – Apr 04, 2016
Recursive auto-detection, bug fixes, JGit update
Release notesGit 1.1 – Jun 01, 2015
Use Git commit date instead of author date
Release notesGit 1.0 – Feb 26, 2015
Initial standalone release of Git plugin for SQ 5.1+
Release notes


Implements SCM dependent features of SonarQube for Git projects. Pure Java implementation so no need to have Git command line tool installed on the computer doing the SQ analysis.


Install the plugin in SonarQube. Auto-detection will work if there is a .git folder in the project root directory or in one of its parent folders. Otherwise you can force the provider using -Dsonar.scm.provider=git. A full clone is required to collect the required blame information (see Known Issues).

Known Issues

  • Trying to collect blame on a shallow clone may either collect incorrect data or fail with an error like:
    ERROR: Caused by: Unable to blame file some/file.xyERROR: Caused by: Missing commit 2f7227db7567a8858495074e8ceb915cd0f54ddd
    Full clone is required to collect all needed information.
    Since 1.3 the plugin will log a warning when a shallow clone is detected, and files will not be blamed.

  • Git doesn't consider old "Mac" line ends (CR) as new lines. As a result the blame operation will contains fewer lines than expected by SonarQube and will fail the analysis. The solution is to fix line ends to use either Windows (CR/LF) or Unix (LF) line ends.

  • JGit doesn't support .mailmap file to "clean" email adress during the blame

Advanced information

The plugin uses the JGit pure Java implementation of Git client:

How to investigate error during blame (only possible on Unix/Linux)?

If you get an error when blame is executed on a file this may be a limitation or a bug in JGit. To confirm please follow these steps:

1 - Identify version of JGit that is used:

SonarQube Git Plugin












2 - Download standalone JGit command line distribution<version>/org.eclipse.jgit.pgm-<version>

3 - Try to execute the blame command on the offending file

chmod +x /where/is/org.eclipse.jgit.pgm-<version>
/where/is/org.eclipse.jgit.pgm-<version> blame -w /path/to/offending/file

4 - If you get the same error than during the SQ analysis then this really looks like a bug in JGit (especially if you don't have issue with the native git command line tool). Please try to do previous steps with latest version of JGit and feel free to report the issue in details on SonarQube Community Forums.