12 lines
389 B
Bash
12 lines
389 B
Bash
#!/bin/bash
|
|
gitTop=$( git rev-parse --show-toplevel 2> /dev/null )
|
|
[[ "" == "$gitTop" ]] && exit 0
|
|
gitRemotes=$gitTop/.gitremotes
|
|
[[ ! -e $gitRemotes ]] && exit 0
|
|
# if exists added remote repos then exit
|
|
[[ "$( git remote -v )" == "" ]] && exit 0
|
|
remotes=$(sed '/origin/d' $gitRemotes | awk 'NR%2==0 {print $1";"$2 }')
|
|
for r in $remotes ; do
|
|
git remote add $(echo $r | sed 's/;/ /')
|
|
done
|