]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(hooks/post-update): Add remote `origin` if not exists
authorOleg Broytman <phd@phdru.name>
Fri, 14 Aug 2020 15:13:11 +0000 (18:13 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 14 Aug 2020 15:13:11 +0000 (18:13 +0300)
hooks/post-update

index 45de97eaacd53d9ee7a67ac0d2ab5a157d79924d..62e3b0f0818552f1d395152062094bf3e6b8ac8b 100755 (executable)
@@ -6,6 +6,9 @@ for ref in "$@"; do
    if [ "$ref" = refs/heads/master ]; then
       unset GIT_DIR
       cd ../git-scripts &&
-      exec git pull ../git-scripts.git master
+      if ! git remote show -n origin 2>/dev/null; then
+         git remote add origin ../git-scripts.git
+      fi &&
+      exec git pull origin master
    fi
 done