Skip to content

Instantly share code, notes, and snippets.

@mrlannigan
Created May 30, 2014 17:14
Show Gist options
  • Save mrlannigan/68127852a8e3418e077d to your computer and use it in GitHub Desktop.
Save mrlannigan/68127852a8e3418e077d to your computer and use it in GitHub Desktop.
Allow you to operate on git remotes on multiple remote systems.
#!/bin/bash
# call as if calling "git remote"
#
# ./gitRemote.sh add someuser [email protected]:someuser/repo.git
# ./gitRemote.sh remove someuser
ACTION=${@}
USERNAME=myuser
DEPLOYMENTS=("somehost.example.com /web/development1"
"somehost.example.com /web/development2"
"somehost.example.com /web/development3"
"someotherhost.example.com /web/development4")
for deployment in "${DEPLOYMENTS[@]}"
do
set -- $deployment
ssh ${USERNAME}@${1} "echo -n \$(hostname) ' - '; cd ${2}; pwd; git remote -v ${ACTION}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment