-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_enterprise_first
78 lines (50 loc) · 1.47 KB
/
script_enterprise_first
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
72
73
74
75
76
77
78
#! /usr/bin/env bash
# Three major things this code accomplished:y
# 1. create a remote repository using the project's name
# 2. Search for all the files that satisfy the size and file extension criteria
# 3. Push files to remote git repo from local git repo
# Get Username
username=""
# Get Token
token=""
# Get Folder Name
project=`basename $PWD`
project_=`echo ${project// /_}`
# Get Project Name
folder=`echo $PWD | awk -F "/" '{print$(NF-1)}'`
folder_=`echo ${folder// /_}`
# Get SDS Directory
note="# SDS_$folder_/_$project_"
note_=`echo $note | tr -d /`
# Delete Remote Repository on github.laureate.net if existed
# curl -u '$username:$token' -X "DELETE" https://github.laureate.net/api/v3/repos/Laureate/$project_
# Create Remote Repository on github.laureate.net
curl -u '$username:$token' https://github.laureate.net/api/v3/orgs/Laureate/repos -d "{\"name\":\"$project_\"}"
# Generate Local Git Repository
git init
git config user.name "jingyi-li"
# Create .gitignore File
echo
"$note_ gitignore
# Ignore everything
*
# Whitelist anything that's a directory
!*/
# But not these files
!*.R
!*.py
!*.sql
!*.sas
!*.sh
!*.bat
!*.gitignore
!*.md" >> .gitignore
# Ignore Files w/ Size > 5M
find . -size +5M | sed 's|^\./||g' | cat >> .gitignore
# Create README.md File
echo "$note_" >> README.md
# Push to the Origin from Master
git add .
git commit -m 'first commit'
git remote add origin [email protected]:Laureate/$project_.git
git push -u origin master