-
Notifications
You must be signed in to change notification settings - Fork 140
/
Copy pathgit_clone.sh
41 lines (33 loc) · 1.11 KB
/
git_clone.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
#!/bin/bash
# Clone the repo you care about
echo "Enter original git repository url"
read -p '(From GitHub and looks like "https://github.com/some-user/repo-name.git"): ' upstreamVar
echo Ready to clone in this here directory? `pwd`
read -p '(CTRL+C) if you want to quit, otherwise just press "ENTER"'
echo
# Clone the repo
git clone $upstreamVar
echo
# Get info on what directory is named and changing to that path
basename=$(basename $upstreamVar)
dirname=${basename%.*}
echo "Setting up your git repo as $dirname"
cd $dirname
echo
# Ask the user for their repository to make commits to
echo "Now for YOUR repository url (from GitHub)"
read -p "If you haven't done so already, go to github.com and make an new (empty repo): " myUpstreamVar
# Changing remote to user's
git remote set-url origin $myUpstreamVar
echo
# Verification
echo "Please verify your remote was:"
git remote -v
echo
echo "Please verify your credentials:"
echo username: `git config user.name`
echo email: `git config user.email`
# Do a git push (sync with GitHub)
echo
read -p 'Continue to push to your GitHub repo? "ENTER" to continue'
git push -u origin