-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-create
More file actions
executable file
·32 lines (27 loc) · 788 Bytes
/
Copy pathgit-create
File metadata and controls
executable file
·32 lines (27 loc) · 788 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
#!/bin/bash
username=$1
repo_name=$2
private_arg=$3
# Check if username is empty
if [[ -z $username ]]; then
echo "Username required."
echo "Usage: git create Username RepoName [private flag]"
exit 1
fi
# Check if Repo name is empty
if [[ -z $repo_name ]]; then
echo "Repo name required."
echo "Usage: git create Username RepoName [private flag]"
exit 1
fi
private_flag=', "private" : "true"'
if [[ -z $private_arg ]]; then
echo "Making a public repo ..."
private_flag=''
else
echo "Making a private repo ..."
fi
curl -u $username https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"$private_flag}"
git init
# git remote add origin git@github.com:$username/$repo_name.git
git remote add origin "https://github.com/$username/$repo_name"