-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_setup.sh
More file actions
executable file
·37 lines (31 loc) · 1.07 KB
/
git_setup.sh
File metadata and controls
executable file
·37 lines (31 loc) · 1.07 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
#!/bin/bash
# Sets up gitlab environment and prompts to pull repositories from gitlab
# Uses --global switch when setting user name and e-mail
# Prerequisites (software)
sudo apt-get -y install git xclip
# Enter user details
read -p "Enter your gitlab e-mail address: " email
read -p "Enter your name: " name
# SSH setup
ssh-keygen -t rsa -C "$email"
xclip -sel clip < ~/.ssh/id_rsa.pub
printf "$(tput setaf 2)!!! PUBLIC SSH KEY WAS COPIED TO CLIPBOARD, PLEASE ADD IT HERE: $(tput smul)https://git.kpi.fei.tuke.sk/profile/keys$(tput rmul) !!!$(tput setaf 7)\n"
while true; do
read -p "Confirm by typing 'Done': " answer
if [[ $answer = "Done" ]]; then
break
fi
done
# User config
git config --global user.email "$email"
git config --global user.name "$name"
# Adding repositories
while true; do
read -p "Do you want to pull repository ? [Y/n] " answer
if [[ ($answer = "y") || ($answer = "Y") ]]; then
read -p "Enter repository address from https://git.kpi.fei.tuke.sk/dashboard/projects : " repo
git clone $repo
elif [[ ($answer = "n") || ($answer = "N") ]]; then
break
fi
done