freebsd上安装git(2)

本文转载自:     http://cni.stanford.edu/wiki/Git

Git

We are using gitosis to manage our git repositories on nims.

Contents

[hide]

initial client configuration

IMPORTANT: This needs to be done on each machine you are planning to use git from.

git config --global user.name "YOUR NAME"
git config --global user.email [email protected]
git config --global color.ui auto
git config --global core.excludesfile '~/.gitignore'

cat << EOF >> ~/.gitignore
.DS_Store
.*.swp
.sconsign.dblite
*.[ao]
*.so
*.py[co]
EOF

creating a new repository

  1. Get an up-to-date version of the gitosis-admin repository by cloning or pulling.
  2. Configure gitosis.conf according to your needs. Add ssh keys as necessary. Commit and push gitosis-admin.
  3. Set up a new repository on your local machine and push it to the host server.
mkdir PROJECT && cd PROJECT
touch README.txt
git init && git add . && git commit -m 'initial commit'
git remote add origin [email protected]:PROJECT.git
git config branch.master.remote 'origin'
git config branch.master.merge 'refs/heads/master'
git push origin master

From now on, a simple git push will be enough.

cloning an existing repository

git clone [email protected]:PROJECT.git

E.g.,

git clone [email protected]:ge.git
git clone [email protected]:arduino.git

After this, git push and git push will work.

gitosis on FreeBSD

## http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
## http://eagain.net/gitweb/?p=gitosis.git;a=blob_plain;f=README.rst;hb=HEAD

## on server
portmaster devel/py-gitosis     # devel/git: disable P4, CVS, CURL
su - git
gitosis-init < /tmp/id_rsa.pub  # this is your public key; or paste at prompt, then enter

## on admin client
git clone [email protected]:gitosis-admin.git
cd gitosis-admin && vim gitosis.conf                        # add your project(s) and users
git mv keydir/user.pub keydir/newuser.pub                   # if you don't like the default; must match gitosis.conf
git add keydir/anotheruser.pub                              # the public ssh key of another user
git commit -a -m 'adding new projects' && git push

Now you can simply push and pull repositories according to the rules described in gitosis.conf.

git

相关推荐