This tutorial

  • I’m creating shared folder that is easy to share with other users
  • I’m creating Git repository to local and move it to server so other users can us it as well.

I’m using Xubuntu 12.04.03 32bit
You need to have installed openssh-server and git.

Create user and lock it.

server$ sudo adduser soivishare
server$ sudo usermod --lock soivishare

Create folder and give group rights. Use SetGID ( ‘s’ ) so all folders have same permissions.

server$ sudo mkdir /home/soivishare/repository
server$ sudo chmod g+rwxs /home/soivishare/repository/

Add folder owner group to soivishare and add it to users what can use the shared folder.

server$ sudo chown .soivishare /home/soivishare/repository/
server$ sudo adduser exampleUser soivishare

You need to logout / exit to get rights working.

server$ exit

Login again and create file.

server$ nano /home/soivishare/repository/hello.txt
server$ cat /home/soivishare/repository/hello.txt 
Hello World!

Now you have shared folder.

Create repository

server$ cd /home/soivishare/repository/
server$ mkdir helloGit.git
server$ cd helloGit.git/
server$ git init --bare --shared
server$ exit

Create folder what you want to add in repository.

$ mkdir helloGit
$ cd helloGit/

Create empty git and add README file

$ git init
$ nano README

Hello GIT

Add and commit. Using -m you can write message directly to commit command.

$ git add .
$ git commit -m "Added README"

Add repository to your repository

$ git remote add origin ssh://exampleUser@example.net/home/soivishare/repository/helloGit.git

Push your project to repository

$ git push origin master
$ git branch --set-upstream master origin/master

Modify README and test repository really works

$ nano README
MODIFIED 27.11.2013
Hello GIT
$ git add . && git commit -m "Modified README"
$ git pull && git push
$ cd ..

Create new folder and make clone.

$ mkdir clone
$ cd clone/
$ git clone ssh://exampleUser@example.net/home/soivishare/repository/helloGit.git

Test that your newest version comes to repository.

cat helloGit/README 
MODIFIED 27.11.2013
Hello GIT

Now you have:

  • Shared folder that other users can use
  • Local repository
  • Server repository

Source
Initializing Git remote server
Git from Offline to Network
Shared Folder with chmod SetGID