diff --git a/bin/tools/foamPackRelease b/bin/tools/foamPackRelease
index afd19f1cee4506c710b970d7cee68db624bc31e2..d58085ccdff50330cacd0407744abb08481695e0 100755
--- a/bin/tools/foamPackRelease
+++ b/bin/tools/foamPackRelease
@@ -51,6 +51,7 @@ options:
   -no-prefix        Do not prefix subdirectory
   -compress=TYPE    Compress with specified type
   -sep=SEP          Change version/patch separator from '_' to SEP
+  -gitbase=DIR      Alternative repo location
   -with-api=NUM     Specify alternative api value for packaging
   -tgz              Alias for -compress=tgz
   -help             Print help
@@ -86,6 +87,7 @@ outputDir="."
 versionSeparator='_'
 withPatchNum=true
 unset compress packageApi withSource withModules prefixDir tarName
+unset gitbase
 
 while [ "$#" -gt 0 ]
 do
@@ -124,6 +126,9 @@ do
     -sep=*)
         versionSeparator="${1#*=}"
         ;;
+    -gitbase=*)
+        gitbase="${1#*=}"
+        ;;
     -with-api=*)
         packageApi="${1#*=}"
         ;;
@@ -175,8 +180,18 @@ findGitDir()
     )
 }
 
-echo "Find git repository ... from script location" 1>&2
-gitbase=$(findGitDir "${0%/*}")
+if [ -d "$PWD/.git" ] && [ -d "$PWD/META-INFO" ]
+then
+    echo "Use git repository ... from current directory" 1>&2
+    gitbase=$(findGitDir "$PWD")
+fi
+
+##DEBUG unset gitbase
+if [ -z "$gitbase" ]
+then
+    echo "Find git repository ... from script location" 1>&2
+    gitbase=$(findGitDir "${0%/*}")
+fi
 
 ##DEBUG unset gitbase
 if [ -z "$gitbase" ]
@@ -185,7 +200,7 @@ then
     gitbase=$(findGitDir "$PWD")
 fi
 
-[ -d "$gitbase" ] || die "Could not locate a git directory"
+[ -d "$gitbase/.git" ] || die "Could not locate a git directory"
 echo "Detected git repository at $gitbase" 1>&2