User and Repository List

Git Client Setup and Usage

Install Client Tool

  1. Download msysgit from http://code.google.com/p/msysgit/downloads/list (Git-1.6.5.1-preview20091022.exe for current)
  2. Download Tortoisegit from http://code.google.com/p/tortoisegit/downloads/list (depend on the architecture)
  3. Install msysgit first and then install Tortoisegit

Server Administration

Install Git Server

  • Install Python setuptools
sudo apt-get install python-setuptools
  • Get source code and install
git clone git://eagain.net/gitosis.git

cd gitosis
python setup.py install
  • Add Git server administration account
sudo adduser \
    --system \
    --shell /bin/sh \
    --gecos 'git version control' \
    --group \
    --disabled-password \
    --home /home/git \
    git
  • Generate a SSH key and initialize Git server
ssh-keygen -t rsa
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub

# This command is very important!
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

Add User

  • First, we need clone server config files. Skip this step if you've cloned the respository.
git clone git@rswiki.csie.org:gitosis-admin.git
  • Enter the administration directory
cd gitosis-admin
  • Generate a new SSH key pair and put the public key in keydir/
# save key pair to ~/gitkeys/USERNAME
ssh-keygen -t rsa
copy ~/gitkeys/USERNAME.pub keydir/
git add keydir/USERNAME.pub
git commit
git push

Create Respository

To create a repository, just add the respository name to writable attribute in gitosis-admin/gitosis.conf

For example, if we want to create a respository named test_repos for user whitestone:

  • Edit the local copy of gitosis.conf and add the following lines
[group test_group]
members = whitestone root@rswiki
writable = test_repos
  • Commit the change
git add gitosis.conf
git commit
git push
  • Create a local directory for the respository and commit it.
cd /tmp
mkdir test_repos
cd test_repos
git init
git remote add origin git@rswiki.csie.org:free_monkey.git
git push origin master:refs/heads/master
documents/git/git.txt · 上一次變更: 2010/03/03 10:55 由 whitestone
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0