Setup a Git Shared read/write Remote Server for Team Development

October 14th, 2011 by Regaz

Prerequisite is to have SSH access into your Domain.
Steps:

  1. Setup the Remote Shared Repo
    scp -P yourSSHPort -r sharedProject.git yourUserName@yourDomain:/path/To/Repo
    ssh yourUserName@yourDomain
    cd pathToRepo/sharedProject.git
    git init --bare
  2. Setup the Remote Server
    ssh -p yourSSHPort yourUserName@yourDomain
    cd ~
    mkdir .ssh

    Each user need to Generate a SSH Public Key and send you by email.
    To append the ssh keys your receive from the Team’s members:

    cat path/To/id_rsa.userName.pub >> ~/.ssh/authorized_keys

    Or if the send you only the file content when you copy and paste inside the authorized_keys file you need to check that the Pasted content is all in One unique Line without returns.

  3. Limit Users Permissions
    pico /etc/passwd

    Modify the line containit “git:x:1000:1000…” as it look like:

    git:x:1000:1000::/home/git:/usr/bin/git-shell

    This will limit User’s Power to Git Operations and Prevent the SSH Access to Shell.

  4. Check this…


    Git Git, Git Tutorial, Git Getting-Started

    Apache Virtual Host

After this Setup the Generic User can Begin to Develop on his Local Machine like:

cd path/To/userProject
git clone yourUserName@yourDomain:/path/To/Repo/sharedProject.git

After he make some Changes and want to Push to Remote Repo:

git commit -am 'description'
git push origin master


Tags: , ,