diff --git a/sanityCheck b/sanityCheck
index b8130584c46614c602472ffb73ecf94d76bcafd2..86fc59fbd13a0514a7f64f95d7f96a657d608492 100755
--- a/sanityCheck
+++ b/sanityCheck
@@ -1,4 +1,9 @@
 #!/bin/bash
+if [ ! -d ".git" ]; then
+	#not running in git repo, so can't use git commands :-)
+	echo "No .git repo found - skipping sanity checks"
+	exit 0
+fi
 # Check for missing right angle bracket: <</if>
 git grep "<</[^>]*>[^>]" -- 'src/*'
 git grep "<<[^>]*>[^<>"$'\r]*\r'"\?$" -- 'src/*'