To setup Git server in Ubuntu 14.04, log in admin account in Ubuntu:
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 *
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
Now in andy account (normal user account):
1) set name and email for git
git config --global user.email "andy@example.com"
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 andy@192.168.1.80:/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/serverguide/git.html
Video: Set up Git server in Ubuntu 14.04
No comments:
Post a Comment