Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new profile at My new blog is at

Entry 1: Serving a Private Git Repo With Sharing

Topic: Version Control   

Tags:  SoftwareDev   VCS   

Created on Fri, 29 Jun 2012.

This is pretty much a sumary of what was already said at ...

... plus a few customizations and a suggested method of how to init a bare git repo for a user that is restricted by git-shell.

Step 1)

Install Git server:

sudo apt-get install git-server

after installing git-server create a user account which will own the shared repo. Usually just using 'git' is ok, but if you are serving to different organizations, then you would liek to give them their own username so that they cannot access all the other projects ( I would prefix their username with git so that I can recognize why that user is on my system... something like gitjsdesign). If you're on a shared server or cloud, you can protect the data by encrypting their home folder... using (in Ubuntu at least)..

adduser --encrypt-home gitjsdesign

without encryption, you can use:

adduser gitjsdesign

step 2)

ask gitjsdesign to use ssh and create a public key which they can send(email) you. Add their public key to the authorized_keys file at /home/gitjsdesign/.ssh/authorized_keys. add your own public key in there too.


protect your shell by restricting their access.

find our where the git-shell is:

which git-shell

lets say we got /usr/bin/git-shell

now we edit the /etc/passwd file

sudo vi /etc/passwd

then change




step 4)

create the project repo.

using your regular user account, go to the home directory of the git user,

cd /home/gitjsdesign/

initialize a bare repo... ** run sudo as gitjsdeign so that they own it.

sudo -u gitjsdesign git init ourProject.git --bare

Now, the user can go to their project root and run

git init git add . git commit -m 'initial commit' git remote add origin gitjsdesign@gitserver:ourProject.git git push origin master

PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus

All Entries Within This Topic:

Subscribe to this topic:

Browse Topics: