-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathNOTES_setupGitServer_on_yourOwn.txt
37 lines (34 loc) · 1.07 KB
/
NOTES_setupGitServer_on_yourOwn.txt
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
#***** SETUP YOUR OWN GIT SERVER
#*** Install GIT, we assume it is 192.168.33.80
sudo apt-get install git-core
# Setup GIT User
sudo adduser git
su git
cd
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
# Create a private/Public key locally
ssh-keygen -t rsa -b 4096 "your email id"
# Copy this file over to server
scp [email protected]:/tmp/id_rsa.pub
# on server, append it back to gIT user's authorized key
su git
cd
cat /tmp/id_rsa.pub >> ./.ssh/authorized_keys
# Create a directory adnd initialize an empty directory
mkdir -p /opt/git/starter.git
cd /opt/git/starter.git
git init --bare
# On local machine
# initialize git
mkdir -p /home/git/starter
cd /home/git/starter
git init
# Optionally add files..
# git add .; git commit -m "Some comment"
# set origin to remote server.
git remote add origin ssh://[email protected]:/opt/git/starter.git
git push origin master
# At this point, everyone can start using this repos...
# Secure your git account by changing the shell to
chsh git # change to git-shell to prevent login...