git-retry.sh 296 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

#Simple script to retry git clone in case of failure

REALGIT=/usr/bin/git

RETRIES=10
DELAY=10
COUNT=1
while [ $COUNT -lt $RETRIES ]; do
Rohit Gupta's avatar
Rohit Gupta committed
11
  $REALGIT $* >> git-clone-`hostname`-log.txt 2>&1
12
13
14
15
16
17
18
  if [ $? -eq 0 ]; then
    RETRIES=0
    break
  fi
  let COUNT=$COUNT+1
  sleep $DELAY
done