Skip to content

Instantly share code, notes, and snippets.

@yusufhm
Created October 1, 2015 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusufhm/0ce70e1e4e3efac8be76 to your computer and use it in GitHub Desktop.
Save yusufhm/0ce70e1e4e3efac8be76 to your computer and use it in GitHub Desktop.
Add git remote if it does not exist
#!/bin/bash
$remote_name=$1
$remote_url=$2
git ls-remote --exit-code $remote_name &>/dev/null
if [ $? -ne 0 ]; then
git remote add $remote_name $remote_url
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment