#!/bin/sh if [ $# -lt 2 ] || [ $# -gt 3 ]; then printf 'usage: %s []\n' "$0" 1>&2 exit 1 fi name="$1" url="$2" branch="$3" if [ -z "$name" ]; then printf 'Need a remote name\n' 1>&2 exit 1 fi if [ -z "$url" ]; then printf 'Need a URL\n' 1>&2 exit 1 fi if [ -z "$branch" ]; then branch='master' fi if git remote add --no-tags -t "$branch" "$name" "$url"; then cp .git/config ../etc/git-config fi exit 0