diff --git a/src/core/output.jl b/src/core/output.jl
index 4144d8f0fd2cdded464fc73761bf2e799b03f233..c545317da2a00737ca05e8ddc521014ef3ee0239 100644
--- a/src/core/output.jl
+++ b/src/core/output.jl
@@ -88,7 +88,11 @@ settings used. This allows replicating a run in future.
 function saveinputfiles(model::SimulationModel)
     #XXX If this is a parallel run, we should save the global config to the top-level
     # output directory
-    currentcommit = read(`git rev-parse HEAD`, String)[1:8]
+    try # if this is loaded as a package, the directory may not be a git repo
+        currentcommit = read(`git rev-parse HEAD`, String)[1:8]
+    catch
+        currentcommit = "********"
+    end
     mkpath(joinpath(@param(core.outdir), RECORDDIR))
     open(joinpath(@param(core.outdir), RECORDDIR, basename(@param(core.configfile))), "w") do f
         println(f, "#\n# --- Persefone configuration parameters ---")