diff --git a/component/libgit2/buildout.cfg b/component/libgit2/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..f7e1ae3c44f75abd84c0aee4736f815d2a5d1ca0
--- /dev/null
+++ b/component/libgit2/buildout.cfg
@@ -0,0 +1,29 @@
+[buildout]
+extends =
+  ../cmake/buildout.cfg
+  ../curl/buildout.cfg
+  ../openssl/buildout.cfg
+  ../pkgconfig/buildout.cfg
+  ../zlib/buildout.cfg
+
+[libgit2]
+# The version here heavily depends on the version of 'rugged' gem that
+# is used in gitlab.
+recipe = slapos.recipe.cmmi
+url = https://github.com/libgit2/libgit2/archive/v0.24.0.tar.gz
+md5sum = 8cabf04502d7203793b32f47ca410ae3
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+configure-command = ${cmake:location}/bin/cmake
+configure-options =
+  -DCMAKE_INSTALL_PREFIX=${:location}
+  -DCURL=1
+  -DUSE_GSSAPI=0
+  -DUSE_OPENSSL=1
+  -DUSE_SSH=0
+  -DCMAKE_INSTALL_RPATH=${curl:location}/lib:${openssl:location}/lib:${zlib:location}/lib
+environment =
+  CMAKE_INCLUDE_PATH=${curl:location}/include:${openssl:location}/include:${zlib:location}/include
+  CMAKE_LIBRARY_PATH=${curl:location}/lib:${openssl:location}/lib:${zlib:location}/lib
+  LDFLAGS=-L${curl:location}/lib
+  PATH=${pkgconfig:location}/bin:%(PATH)s
+  PKG_CONFIG_PATH=${curl:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig
diff --git a/software/gitlab/software.cfg b/software/gitlab/software.cfg
index 37b6014bb457d763bfd7d7f6f87bf1c60c936b2f..50efc2aafb41ad2b20b29e7f4cbf7e63220bbe69 100644
--- a/software/gitlab/software.cfg
+++ b/software/gitlab/software.cfg
@@ -12,6 +12,7 @@ extends =
     ../../component/nodejs/buildout.cfg
     ../../component/openssl/buildout.cfg
     ../../component/nginx/buildout.cfg
+    ../../component/libgit2/buildout.cfg
 
 #   for instance
     ../../component/bash/buildout.cfg
@@ -144,6 +145,7 @@ bundle  = ${bundler-4gitlab:bundle}
 
 configure-command = cd ${:path} &&
     ${:bundle} config --local build.charlock_holmes --with-icu-dir=${icu:location}  &&
+    ${:bundle} config --local build.rugged --use-system-libraries=true --with-git2-include=${libgit2:location}/include --with-git2-lib=${libgit2:location}/lib
     ${:bundle} config --local build.pg  --with-pg-config=${postgresql92:location}/bin/pg_config
 
 make-binary =