diff --git a/contrib/src/libgit2/0001-fix-getentropy.patch b/contrib/src/libgit2/0001-fix-getentropy.patch
deleted file mode 100644
index 2df8d3b1427a036cbb657bf5f0b5c4a298d24343..0000000000000000000000000000000000000000
--- a/contrib/src/libgit2/0001-fix-getentropy.patch
+++ /dev/null
@@ -1,25 +0,0 @@
- src/util/rand.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/util/rand.c b/src/util/rand.c
-index 940faf947..7b3f20774 100644
---- a/src/util/rand.c
-+++ b/src/util/rand.c
-@@ -10,7 +10,7 @@ See <http://creativecommons.org/publicdomain/zero/1.0/>. */
- #include "rand.h"
- #include "runtime.h"
-
--#if defined(GIT_RAND_GETENTROPY)
-+#if defined(GIT_RAND_GETENTROPY) && defined(HAVE_SYS_RANDOM_H)
- # include <sys/random.h>
- #endif
-
-@@ -85,7 +85,7 @@ GIT_INLINE(int) getseed(uint64_t *seed)
- 	bits convert;
- 	int fd;
-
--# if defined(GIT_RAND_GETENTROPY)
-+# if defined(GIT_RAND_GETENTROPY) && defined(HAVE_SYS_RANDOM_H)
- 	GIT_UNUSED((fd = 0));
-
- 	if (getentropy(seed, sizeof(uint64_t)) == 0)
diff --git a/contrib/src/libgit2/SHA512SUMS b/contrib/src/libgit2/SHA512SUMS
index a6f1eac31a046a3985dbba02d94ac29f5229ea16..434d162944173cbcfa34b5036de3c7820c577bca 100644
--- a/contrib/src/libgit2/SHA512SUMS
+++ b/contrib/src/libgit2/SHA512SUMS
@@ -1 +1 @@
-fd73df91710f19b0d6c3765c37c7f529233196da91cf4d58028a8d3840244f11df44abafabd74a8ed1cbe4826d1afd6ff9f01316d183ace0924c65e7cf0eb8d5  libgit2-v1.6.4.tar.gz
\ No newline at end of file
+e5634267bd9c6a594c9a954d09c657e7b8aadf213609bf7dd83b99863d0d0c7109a5277617dd508abc2da54ea3f12c2af1908d1aeb73c000e94056e2f3653144  libgit2-v1.8.0.tar.gz
\ No newline at end of file
diff --git a/contrib/src/libgit2/package.json b/contrib/src/libgit2/package.json
index fff9df0045a588c9769afec27f215c9192768648..5b74ca49b22dfd8abb41b3698f2382231e064954 100644
--- a/contrib/src/libgit2/package.json
+++ b/contrib/src/libgit2/package.json
@@ -1,6 +1,6 @@
 {
     "name": "libgit2",
-    "version": "v1.6.4",
+    "version": "v1.8.0",
     "url": "https://github.com/libgit2/libgit2/archive/__VERSION__.tar.gz",
     "use_cmake" : true,
     "defines": [
diff --git a/contrib/src/libgit2/rules.mak b/contrib/src/libgit2/rules.mak
index 0fd518fcbee66b76928e122da984b02d98beeb91..80171984e2f093c16bd79871a350d3b2af49a632 100644
--- a/contrib/src/libgit2/rules.mak
+++ b/contrib/src/libgit2/rules.mak
@@ -1,9 +1,9 @@
 # LIBGIT2
-LIBGIT2_VERSION := 1.6.4
+LIBGIT2_VERSION := 1.8.0
 LIBGIT2_URL := https://github.com/libgit2/libgit2/archive/v${LIBGIT2_VERSION}.tar.gz
 
 PKGS += libgit2
-ifeq ($(call need_pkg,"libgit2 >= 1.6.0"),)
+ifeq ($(call need_pkg,"libgit2 >= 1.6.4"),)
 PKGS_FOUND += libgit2
 endif
 
@@ -17,7 +17,6 @@ $(TARBALLS)/libgit2-v$(LIBGIT2_VERSION).tar.gz:
 libgit2: libgit2-v$(LIBGIT2_VERSION).tar.gz .sum-libgit2
 	$(UNPACK)
 	mv libgit2-$(LIBGIT2_VERSION) libgit2-v$(LIBGIT2_VERSION)
-	$(APPLY) $(SRC)/libgit2/0001-fix-getentropy.patch
 	$(APPLY) $(SRC)/libgit2/c-standard.diff
 	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp
index 35b613f080f4e9190846809f0abe878c09213ce5..233a935b6e249eb7b377cc2ca5f74e57dd1a99b4 100644
--- a/src/jamidht/conversationrepository.cpp
+++ b/src/jamidht/conversationrepository.cpp
@@ -781,7 +781,14 @@ ConversationRepository::Impl::createMergeCommit(git_index* index, const std::str
 
     // Commit
     git_buf to_sign = {};
+    // Check if the libgit2 library version is 1.8.0 or higher
+#if( LIBGIT2_VER_MAJOR > 1 ) || ( LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8 )
+    // For libgit2 version 1.8.0 and above
+    git_commit* const parents_ptr[2] {parents[0].get(), parents[1].get()};
+#else
+    // For libgit2 versions older than 1.8.0
     const git_commit* parents_ptr[2] {parents[0].get(), parents[1].get()};
+#endif
     if (git_commit_create_buffer(&to_sign,
                                  repo.get(),
                                  sig.get(),
@@ -1861,7 +1868,13 @@ ConversationRepository::Impl::commit(const std::string& msg, bool verifyDevice)
     GitCommit head_commit {head_ptr, git_commit_free};
 
     git_buf to_sign = {};
+    // Check if the libgit2 library version is 1.8.0 or higher
+#if( LIBGIT2_VER_MAJOR > 1 ) || ( LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8 )
+    // For libgit2 version 1.8.0 and above
+    git_commit* const head_ref[1] = {head_commit.get()};
+#else
     const git_commit* head_ref[1] = {head_commit.get()};
+#endif
     if (git_commit_create_buffer(&to_sign,
                                  repo.get(),
                                  sig.get(),