-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathgitremote.sh
More file actions
executable file
·47 lines (31 loc) · 858 Bytes
/
gitremote.sh
File metadata and controls
executable file
·47 lines (31 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
if [ ! "$1" = "" ] ; then
USERNAME="$1"
SERVER="http://github.com/"
if [ ! "$2" = "" ] ; then
SERVER=$2
fi
while [ "`pwd`" != "/" -a "$GITREPO" = "" ] ; do
if [ -d ./lmkproject ] ; then
GITREPO=`pwd`/src
fi
cd ..
done
if [ "$GITREPO" = "" -a -d "$HOME/cm/src" ] ; then
GITREPO="$HOME/cm/src"
fi
if [ "$GITREPO" != "" ] ; then
echo "Git repositories found in $GITREPO"
echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-"
DIRS="`/bin/ls -1 $GITREPO`"
for dir in $DIRS ; do
if [ -d $GITREPO/$dir/.git ] ; then
echo "Adding remote $USERNAME to $dir"
cd $GITREPO/$dir ; git remote add ${USERNAME} ${SERVER}${USERNAME}/${dir}.git
echo
fi
done
else
echo "Git repositories not found."
fi
fi