Add git new-push-remote script
Anirudh Oppiliappan x@icyphox.sh
Wed, 15 Sep 2021 20:06:13 +0530
2 files changed,
20 insertions(+),
8 deletions(-)
M
darwin/ssh/config
→
darwin/ssh/config
@@ -49,14 +49,6 @@ # Engine Section".
# # You should not hand-edit this section, unless you are deleting it. # -Host rainmaker.asia-south1-c.deepsource-production - HostName 35.200.252.172 - IdentityFile /Users/icy/.ssh/google_compute_engine - UserKnownHostsFile=/Users/icy/.ssh/google_compute_known_hosts - HostKeyAlias=compute.5954000129691123210 - IdentitiesOnly=yes - CheckHostIP=no - Host enterprise.us-central1-a.deepsource-dev HostName 34.133.47.102 IdentityFile /Users/icy/.ssh/google_compute_engine@@ -86,6 +78,14 @@ HostName 35.244.13.133
IdentityFile /Users/icy/.ssh/google_compute_engine UserKnownHostsFile=/Users/icy/.ssh/google_compute_known_hosts HostKeyAlias=compute.4702344397461811265 + IdentitiesOnly=yes + CheckHostIP=no + +Host rainmaker.asia-south1-c.deepsource-production + HostName 35.200.252.172 + IdentityFile /Users/icy/.ssh/google_compute_engine + UserKnownHostsFile=/Users/icy/.ssh/google_compute_known_hosts + HostKeyAlias=compute.5954000129691123210 IdentitiesOnly=yes CheckHostIP=no
A
home/bin/git-new-push-remote
@@ -0,0 +1,12 @@
+#!/bin/sh +# git new-push-remote: adds a new push-only remote to a repository +# without removing the existing push remote. + +[[ "$@" == "" ]] && { + printf '%s\n' "usage: git new-push-remote <remote url>" + exit +} + +old_push_remote="$(git remote -v | grep '(push)' | awk '{print $2}')" +git remote set-url "$(git remote show)" --add --push "$1" +git remote set-url "$(git remote show)" --add --push "$old_push_remote"