Step 1: Install Git. SSH into the remoteserver and install git using apt-get. This installs git under /usr/bin
sudo apt-get update
sudo apt-get install git-core
sudo apt-get install git-core
Step 2: Set up Git Users
sudo groupadd developers
sudo useradd -G developers -d /home/timmolter -m -s /bin/bash timmolter
sudo passwd timmolter
sudo useradd -G developers -d /home/timmolter -m -s /bin/bash timmolter
sudo passwd timmolter
Step 3: Passwordless SSH
Logged into remote account:
mkdir .ssh
From local account**:scp ~/.ssh/id_rsa.pub timmolter@hostname:.ssh/authorized_keys
**assuming you already have a SSH key. If not try here.Step 4: Setup a shared repository
Using an account with sudo-rights ("manager" - not a developer user that you just created):
cd ~
mkdir -p repositories/project.git
cd repositories/project.git
git init --bare --shared=group
ls -l
sudo chgrp -R developers .
ls -l
mkdir -p repositories/project.git
cd repositories/project.git
git init --bare --shared=group
ls -l
sudo chgrp -R developers .
ls -l
Now you have your Git repository and you can push you project to it!
Step 5 (optional):
Setup a symbolic link to the repository so the user can access it directly from his/her account.
sudo ln -s /home/manager/repositories/project.git/ /home/timmolter/
Piece of cake!!!
References
kovshenin.comuseradd
No comments:
Post a Comment