-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitter.sh
71 lines (50 loc) · 1.16 KB
/
committer.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No argument provided. Please provide a directory name."
exit 1
fi
if [[ "$EUID" -ne 0 ]]; then
echo "Please run as root"
exit 1
fi
echo "First Argument: $1"
cd "$1" || { echo "Directory '$1' not found"; exit 1; }
if [ ! -e ".gitignore" ]; then
echo ".gitignore file not found."
exit 1
fi
if [ ! -d ".git" ]; then
echo ".git directory not found."
exit 1
fi
if [ ! -e ".gitattributes" ]; then
echo ".gitattributes file not found."
exit 1
fi
echo "All required files and directories found. Proceeding..."
rm -rf .git
sleep 2
rm .gitignore .gitattributes
sleep 2
cp ../boxesApp/.gitignore ./
cd ../
git add "$1"
sleep 2
git status
sleep 5
git commit -m"Committing $1 files with bash script."
sleep 5
echo "Enter your GitHUb credentials for git push:"
read -p "Username:" username
read -s -p "Password: " password
echo
sleep 2
touch ./.git-credentials
git config credential.helper 'store --file ./.git-credentials'
echo "https://$username:$password@github.com" > ./.git-credentials
chmod 600 ./.git-credentials
sleep 3
git push origin master
sleep 2
rm ./.git-credentials
exit 0