-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone_git_repos.bash
More file actions
executable file
·52 lines (43 loc) · 1.06 KB
/
Copy pathclone_git_repos.bash
File metadata and controls
executable file
·52 lines (43 loc) · 1.06 KB
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
48
49
50
51
#!/bin/bash
#filename: clone_git_repos_with_ssh.sh
#author: Theodore Knab
#date: 5/19/2020
#description: sync all known repos to aws s3
list_of_repos="bash perl puppet-apache python ruby"
mydate=`date +%m_%d_%Y_%H%M`
bucket="mys3bucket_name"
proto="ssh" #or https
#git info
username='zeekus'
password=""
mkdir git_$mydate
#change to dir just created
cd git_$mydate
for url in $list_of_repos
do
echo $myurl
echo "protocol is $proto"
if [ $proto == "ssh" ]; then
myssh="git@github.com:$username/$url.git"
git clone $myssh
else
if [ $password -eq "" ]; then
echo "no password given exiting... We need a password."
exit 1
else
myhttp="https://$username:$password@github.com/$username/$url.git"
git clone $myhttp
fi
fi
#error checking exit on error
if [[ $? -ne 0 ]]; then
echo "exiting on error"
exit 1
fi
done
#go back to orginal directory
cd ..
#sync this to aws
##aws s3 sync git_$mydate s3://$bucket/git_$mydate/
#sync file
##aws s3 cp clone_git_repos_with_ssh.sh s3://$bucket/