LICENSEWARE

Git GPL-2.0 obligations and the libgit2 linking exception

This article covers what the GPL version 2 requires of anyone who redistributes or modifies Git, the other licences inside the Git source tree, and how the libgit2 linking exception differs. For the overview, see Git licensing. It is not legal advice.

On This Page

Git’s GPL-2.0 obligations are the conditions that the GNU General Public License version 2 places on anyone who copies, modifies or distributes Git. Git’s COPYING file carries the full licence text, headed “Version 2, June 1991”. It is preceded by a project note that makes version 2 the only valid version of the GPL for Git.[1] SPDX identifies this choice as GPL-2.0-only.[9] The Open Source Initiative lists the licence among its approved licences.[11] The conditions do not reach ordinary use: running the program is not restricted.[1] They apply when Git, or software built from it, is passed to another party. libgit2, a separate library implementing Git’s core methods, uses the same licence plus a linking exception. That changes the position of applications that link it.[6] For the overview, see Git licensing.

Editions

Scope of this article:

  • Git source and binaries built from the Git source tree, including operating-system packages and Git for Windows. The GPL-2.0 terms in Git’s COPYING apply.[1]
  • libgit2 and applications that link it, including through language bindings. The libgit2 COPYING applies.[6]

Metrics

None. The GPL grants its rights free of charge and contains no licence metric.[1] The catalog has no metric rows for Git.

Counting / floors

What triggers the licence (licence text of June 1991, as retrieved 2026-09-27). Under §0, activities other than copying, distribution and modification are outside the licence’s scope. The output of the program is covered only if it contains a work based on the program.[1] Under §5, a person who does not modify or distribute Git does not need to accept the licence.[1] Repository content that Git stores or outputs is therefore covered only if that content itself contains a work based on Git. Catalog proof: Running Git is outside the scope of the licence.

Floors. None.

Redistribution obligations

Verbatim copies (§1)

A party that distributes Git’s source as received must publish an appropriate copyright notice and disclaimer of warranty on each copy. It must also keep intact all notices that refer to the licence and to the absence of warranty, and give each recipient a copy of the licence.[1] §3 makes these conditions apply to binary distribution too. The distributor may charge a fee for the physical act of transferring a copy, and may offer warranty protection for a fee.[1] Catalog proof: Redistributed copies must keep notices and include the licence; A fee may be charged for transferring copies and for warranty.

Modified versions (§2)

A party may modify Git and distribute the result if it meets three conditions:[1]

  1. Change notices (§2(a)). Modified files must carry prominent notices that they were changed, with the date of each change. Catalog proof: Modified files must carry change notices.
  2. Copyleft (§2(b)). Any distributed or published work that contains or is derived from Git must be licensed as a whole, at no charge, to all third parties under the GPL-2.0. Catalog proof: Distributed works based on Git must be licensed as a whole under GPL-2.0.
  3. Interactive notice (§2(c)). A modified program that normally reads commands interactively must display a copyright and no-warranty notice when started. This does not apply if the original program does not print such an announcement.

Scope of the copyleft

§2 limits the copyleft in two ways. First, sections of a work that are not derived from Git, and can reasonably be considered independent and separate works, are not covered when distributed as separate works. Second, “mere aggregation” of another work with Git on a storage or distribution medium does not bring that work under the GPL.[1] The licence states that §2 is not meant to claim rights in work written entirely by the distributor. Its aim is to control distribution of derivative or collective works based on the program.[1] Git for Windows publishes MinGit for applications that ship Git alongside their own code. The MinGit documentation describes such applications as ones that spawn git.exe.[12] Catalog proof: Mere aggregation with Git does not extend the GPL to other works.

Source code with binaries (§3)

Git in object code or executable form may be distributed only with one of the following:[1]

Option Condition Who may use it 
§3(a) Accompany the binary with the complete corresponding machine-readable source Any distributor 
§3(b) Accompany the binary with a written offer, valid for at least three years, to give any third party the source for no more than the cost of physically distributing it Any distributor 
§3(c) Pass on the source offer received with the binary Noncommercial distribution only, and only for binaries received with a §3(b) offer 

Source means “the preferred form of the work for making modifications to it”. For an executable, it covers all modules, associated interface definition files and the scripts used to control compilation and installation. Components normally distributed with the operating system are excepted unless they accompany the executable.[1] When binaries are offered for download from a designated place, equivalent access to the source from the same place counts as distributing the source.[1] Catalog proof: Source code must accompany distributed Git binaries or be offered for three years; Complete source includes build and installation scripts; Passing on an upstream source offer is limited to noncommercial distribution; Equivalent download access to source counts as source distribution.

Recipients’ rights, termination and conflicts (§4, §6, §7)

Each recipient automatically receives a licence from the original licensor. A redistributor “may not impose any further restrictions” on how recipients exercise those rights.[1] Copying, modifying, sublicensing or distributing Git other than as the licence allows is void and automatically terminates the licence. Parties who received copies from the infringer keep their rights while they comply.[1] If a court order, patent licence or other obligation prevents a distributor from meeting the licence’s conditions, §7 says it may not distribute the program at all.[1] Catalog proof: No further restrictions may be imposed on recipients; Non-compliant distribution terminates the licence automatically.

No warranty (§11, §12)

Git is provided without warranty “to the extent permitted by applicable law”. The entire risk as to quality and performance is with the user.[1] Catalog proof: Git is provided without warranty.

Other licences in the Git source tree

The Git README states that some parts of the project are under different licences compatible with GPLv2.[2] Three examples:

Directory Component Licence 
sha1dc/ SHA-1 collision detection MIT License[3] 
reftable/ reftable library BSD licence with three clauses[4] 
xdiff/ LibXDiff GNU LGPL version 2.1 or any later version[5] 

The MIT and BSD licences require their copyright and permission notices to be kept in copies of the code.[1][3][4] Catalog proof: Parts of the Git source tree carry other GPLv2-compatible licences.

libgit2

The linking exception

libgit2 describes itself as a portable, pure C implementation of Git’s core methods. It is provided as a re-entrant linkable library for use from C or through bindings for other languages.[8] Its COPYING file states that only GPL version 2 is valid for the project. It then adds a linking exception: the authors give “unlimited permission to link the compiled version of this library into combinations with other programs”, and to distribute those combinations “without any restriction coming from the use of this file”.[6] The README says that software linking the library does not fall under the GPL, and that the library can be used from any program, “proprietary or open source; paid or gratis”.[7] Catalog proof: libgit2 may be linked into proprietary programs under its linking exception.

The exception follows the text of the SPDX exception GCC-exception-2.0 (GCC Runtime Library exception 2.0). Its first sentence names “the authors” where SPDX names the Free Software Foundation, and “this library” where SPDX has “this file”.[10][6] The libgit2 COPYING file does not itself give an SPDX expression.[6]

What the exception does not cover

The GPL restrictions still apply in other respects. They cover modification of the library and its distribution when it is not linked into a combined executable.[6] The README says that a party that modifies libgit2 itself must distribute the source of its modified version.[7] Catalog proof: Modifications to libgit2 itself remain under GPL-2.0.

Bundled dependencies

The libgit2 COPYING file also lists bundled code under other licences. These include zlib (ZLib licence), PCRE2 (PCRE2 Licence), winhttp definition files (GNU LGPL), SHA-1 collision detection (MIT), llhttp (MIT) and portions derived from other projects under their own terms.[6] Catalog proof: libgit2 bundled dependencies carry their own licences.

Git and libgit2 compared

Question Git libgit2 
Licence GPL-2.0-only[1] GPL version 2 only with linking exception[6] 
Internal use Not restricted[1] Not restricted[6] 
Proprietary program linking the code, then distributed Distributed works based on Git fall under §2(b)[1] Permitted without GPL restrictions from the library[6] 
Modified code, distributed Source and GPL terms required[1] Source of the modified library required[7] 

Virtualization & partitioning

Not applicable. The licence is not counted by processor, core or host. A container or virtual machine image that includes Git and is distributed to others is a distribution of Git binaries, and §1 to §3 apply to it.[1]

Cloud / BYOL

Not applicable. Running Git on hosted infrastructure is use, and use is not restricted.[1] GPL-2.0 has no clause that treats providing a network service as distribution.

Programs

None. Neither the Git project nor the libgit2 project publishes a commercial licence or support program in the retrieved documents.

Out of scope

This article does not cover GPL version 3, the licences of Git for Windows’ bundled components (see Git for Windows components, versions and deployment), the Git trademark policy (see Git licensing) or the licence terms of individual libgit2 language bindings.

References

  1. Git COPYING: GNU General Public License version 2 with project noteGPL version 2 only note; GPL-2.0 text, Version 2, June 1991.Retrieved 2026-09-27.
  2. Git READMELicence statement of the Git project.Retrieved 2026-09-27.
  3. Git sha1dc LICENSE (MIT License)Retrieved 2026-09-27.
  4. Git reftable LICENSE (BSD License)Retrieved 2026-09-27.
  5. Git xdiff/xdiff.h licence headerLibXDiff, GNU LGPL version 2.1 or later.Retrieved 2026-09-27.
  6. libgit2 COPYING: GPL version 2 with linking exceptionLinking exception; GPL-2.0 text; bundled dependency licences.Retrieved 2026-09-27.
  7. libgit2 READMELicense section.Retrieved 2026-09-27.
  8. libgit2 websiteProject home page; licensing summary.Retrieved 2026-09-27.
  9. SPDX License List: GPL-2.0-onlySPDX License List 3.29.0.Retrieved 2026-09-27.
  10. SPDX License List: GCC Runtime Library exception 2.0SPDX License Exceptions 3.29.0.Retrieved 2026-09-27.
  11. OSI: GNU General Public License version 2Retrieved 2026-09-27.
  12. MinGit is Git for Windows ApplicationsDistribution intended for third-party applications. Undated.Retrieved 2026-09-27.

See also

Catalog Rows Cited

17Rules

Esc