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 YOU@FOO.COM
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 git@nims.stanford.edu: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 git@nims.stanford.edu:PROJECT.git

E.g.,

git clone git@nims.stanford.edu:ge.git
git clone git@nims.stanford.edu: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 git@nims.stanford.edu: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.

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值