Set up Git server in Ubuntu 14.04

Опубликовано: 17 Май 2014
на канале: Jiansen Lu
22,643
39

In admin account:
1) Install git-core
sudo apt-get install git-core
2) create git master firectory, using --bare for not directly editable
sudo mkdir -p /opt/git/directory.git
sudo git init --bare /opt/git/directory.git
3) create group gitgroup make directory.git and its sub-directories write permission by gitgroup
sudo groupadd gitgroup
sudo chmod -R g+ws *
sudo chgrp -R gitgroup *
3.1) Add exsiting user jiansen to group gitgroup
sudo usermod -G gitgroup jiansen
4) Set sharedRepository true
cd directory.git
sudo git config core.sharedRepository true
5) For test purpose, create new user Andy and assign him to group gitgroup:
sudo adduser andy
sudo groupadd gitgroup
sudo usermod -G gitgroup andy

Now in andy account (normal user account):
1) set name and email for git
git config --global user.email "[email protected]"
git config --global user.name "andy"
2) Clone from master, change 192.168.1.80 to your git server IP, a newdirectory /home/andy/directory will be created
git clone [email protected]:/opt/git/directory.git
3)Create a new file README under directory and commit it
cd directory
vim README
git add README
git commit -am 'fix for the README file by Andy'
4) push to server
git push origin master
Reference:
https://help.ubuntu.com/14.04/serverg...

More about this video:
http://jiansenlu.blogspot.ca/2014/05/...