summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-04-18 11:48:46 +0200
committerJonas Smedegaard <dr@jones.dk>2017-04-18 11:48:46 +0200
commit94618d4acfe1544a994fe0e93d37bc6c34e486ce (patch)
tree340c006ac67978228148025b254140e28b869c12
parent873d7fbd17bb5779c613aadd29e8a8de6abf26f8 (diff)
Fix push also to non-default origin.
-rwxr-xr-xlocalgit-remote-init-push4
1 files changed, 3 insertions, 1 deletions
diff --git a/localgit-remote-init-push b/localgit-remote-init-push
index 7cff8ab..1f5717a 100755
--- a/localgit-remote-init-push
+++ b/localgit-remote-init-push
@@ -53,6 +53,8 @@ GIT_HOST=${2:-source.$(dnsdomainname --domain)}
SSH_CONN=${3:-$GIT_HOST}
GIT_REMOTE=${4:-origin}
+[ origin != "$GIT_ORIGIN" ] || ORIGIN_IS_DEFAULT=yes
+
ssh "$SSH_CONN" git init --bare --shared /srv/git/"$GIT_HOST"/"$PROJECT".git
git remote add "$GIT_REMOTE" "$SSH_CONN":/srv/git/"$GIT_HOST"/"$PROJECT".git
-[ origin != "$GIT_ORIGIN" ] || git push --set-upstream "$GIT_REMOTE" master
+git push ${ORIGIN_IS_DEFAULT:+--set-upstream "$GIT_REMOTE"} master