diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 56650e78c..1a268aa96 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -3,8 +3,17 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x if [[ ! -z $DOKKU_HOST ]]; then function dokku { - appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) - if [[ "$?" != "0" ]]; then + appname="" + if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then + set +e + appname=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + set -e + else + echo "This is not a git repository" + exit 1 + fi + + if [[ "$appname" != "" ]]; then donotshift="YES" fi