]> gitweb.fluxo.info Git - utils-git.git/commitdiff
Adds git-disable-push
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 4 Apr 2017 14:04:27 +0000 (11:04 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 4 Apr 2017 14:04:27 +0000 (11:04 -0300)
git-disable-push [new file with mode: 0755]

diff --git a/git-disable-push b/git-disable-push
new file mode 100755 (executable)
index 0000000..2f9e05c
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Disable push to a given remote
+# See http://stackoverflow.com/questions/10260311/git-how-to-disable-push?answertab=active#tab-top
+
+# Parameters
+BASENAME="`basename $0`"
+REMOTE="$1"
+
+# Check
+if [ -z "$REMOTE" ]; then
+  echo "usage: $BASENAME <remote>"
+  exit 1
+fi
+
+# Run
+git remote set-url --push $REMOTE no_push