Saturday, May 17, 2014

Set up Git server in Ubuntu 14.04

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 ""
  git config --global "andy"

2) Clone from master, change to your git server IP, a newdirectory /home/andy/directory will be created
 git clone andy@
3)Create a new file README under directory and commit it
cd  directory
git add README
 git commit -am 'fix for the README file by Andy'

4) push to server
git push origin master

Video: Set up Git server in Ubuntu 14.04

No comments:

Post a Comment