diff --git a/obis/src/python/obis/dm/checksum.py b/obis/src/python/obis/dm/checksum.py
index e809b48315f33931c404a1048fee98f76701fc28..2df5356dc4bd2db7adee47839de71cc6c15f8689 100644
--- a/obis/src/python/obis/dm/checksum.py
+++ b/obis/src/python/obis/dm/checksum.py
@@ -144,7 +144,7 @@ class ChecksumGeneratorGitAnnex(object):
             raise ValueError("Git annex backend not supported: " + self.backend)
 
     def _get_annex_backend(self):
-        with open('.gitattributes') as gitattributes:
+        with open('.git/info/attributes') as gitattributes:
             for line in gitattributes.readlines():
                 if 'annex.backend' in line:
                     backend = line.split('=')[1].strip()
diff --git a/obis/src/python/obis/dm/data_mgmt.py b/obis/src/python/obis/dm/data_mgmt.py
index 339bb2f40b8016b119352f3ba0cace732c649a85..5c54b14b3ada109e90a1bed1f59e3a87a2e92481 100644
--- a/obis/src/python/obis/dm/data_mgmt.py
+++ b/obis/src/python/obis/dm/data_mgmt.py
@@ -283,6 +283,9 @@ class GitDataMgmt(AbstractDataMgmt):
         if result.failure():
             return result
         with cd(path):
+            result = self.git_wrapper.initial_commit()
+            if result.failure():
+                return result
             # Update the resolvers location
             self.settings_resolver.set_resolver_location_roots('data_set', '.')
             self.settings_resolver.copy_global_to_local()
diff --git a/obis/src/python/obis/dm/git.py b/obis/src/python/obis/dm/git.py
index 43261db427a561441c51b576cb96c95fc48924a2..32a5b670283adf2f7b984694db52fcf77084f36f 100644
--- a/obis/src/python/obis/dm/git.py
+++ b/obis/src/python/obis/dm/git.py
@@ -1,5 +1,6 @@
 import shutil
 import os
+from pathlib import Path
 from .utils import run_shell
 from .command_result import CommandResult, CommandException
 from .checksum import ChecksumGeneratorCrc32, ChecksumGeneratorGitAnnex
@@ -63,18 +64,25 @@ class GitWrapper(object):
             return result
 
         attributes_src = os.path.join(os.path.dirname(__file__), "git-annex-attributes")
-        attributes_dst = os.path.join(path, ".gitattributes")
+        attributes_dst = os.path.join(path, ".git/info/attributes")
         shutil.copyfile(attributes_src, attributes_dst)
         self._apply_git_annex_backend(attributes_dst, git_annex_backend)
-        cmd = [self.git_path, "-C", path, "add", ".gitattributes"]
-        result = run_shell(cmd)
-        if result.failure():
-            return result
 
-        cmd = [self.git_path, "-C", path, "commit", "-m", "Initial commit."]
-        result = run_shell(cmd)
         return result
 
+    def initial_commit(self):
+        # initial commit is needed. we can restore to it when something fails
+        folder = '.obis'
+        file = '.gitignore'
+        path = folder + '/' + file
+        if not os.path.exists(folder):
+            os.makedirs(folder)
+        Path(path).touch()
+        result = self.git_add(path)
+        if result.failure():
+            return result
+        return self.git_commit("Initial commit.")
+
     def _apply_git_annex_backend(self, filename, git_annex_backend):
         if git_annex_backend is not None:
             lines = []