diff --git a/obis/src/python/obis/dm/git.py b/obis/src/python/obis/dm/git.py
index db568d12296def18cf5af97d41e7b484bf9dfbd5..13b3d421de09162688db9730005ad01c3f24d174 100644
--- a/obis/src/python/obis/dm/git.py
+++ b/obis/src/python/obis/dm/git.py
@@ -39,6 +39,12 @@ class GitWrapper(object):
         if self._git(['annex', 'help']).failure():
             # git help should have a returncode of 0
             return False
+        result = self._git(['annex', 'version'])
+        if result.success():
+            first_line = result.output.split("\n")[0].split(":")
+            if len(first_line) > 1:
+                self.annex_version = first_line[1].strip()
+                self.annex_major_version = int(self.version.split(".")[0])
         return True
 
     def git_init(self):
@@ -72,7 +78,7 @@ class GitWrapper(object):
             return result
 
         # direct mode so annex uses hard links instead of soft links
-        cmd = ["annex", "direct"]
+        cmd = ["annex", "unlock" if self.annex_major_version >= 8 else "direct"]
         result = self._git(cmd)
         if result.failure():
             return result
@@ -112,7 +118,10 @@ class GitWrapper(object):
 
     def git_add(self, path):
         # git annex add to avoid out of memory error when adding files bigger than RAM
-        return self._git(["annex", "add", path, "--include-dotfiles"])
+        cmd = ["annex", "add", path]
+        if self.annex_major_version < 8:
+            cmd.append("--include-dotfiles")
+        return self._git(cmd)
 
     def git_commit(self, msg):
         return self._git(['commit', '--allow-empty', '-m', msg])