Git Daemon

1。事先你的git应装完了
#apt-get install git git-core
或用原码装

2。装git-daemon
#apt-get install git-daemon-run

3。设置/etc/service/git-daemon/run
bash$  cat /etc/service/git-daemon/run
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec git daemon --reuseaddr --export-all --verbose --base-path=/wrgit  /wrgit
bash$ 

4. 重启git-daemon
bash$  ps -eaf | grep -v grep | grep git
root      5132  5086  0 08:44 ?        00:00:00 runsv git-daemon
gitlog    5195  5132  0 08:44 ?        00:00:00 svlogd -tt /var/log/git-daemon
root     16555  5132  0 16:57 ?        00:00:00 git-daemon --reuseaddr --export-all --verbose --base-path=/wrgit /wrgit

可以kill 掉对应进程,这时runsv会重启git-daemon
或使用
# sv down git-daemon
# sv up git-daemon

5. 查看 git-daemon所使用的端口是否工作正常
bash$  sudo lsof -i:9418
COMMAND     PID USER   FD   TYPE DEVICE SIZE NODE NAME
git-daemo 16555 root    3u  IPv6  72970       TCP *:git (LISTEN)
git-daemo 16555 root    4u  IPv4  72971       TCP *:git (LISTEN)

这一般下来应该没问题。
试试服务是否正常工作:
bash$  git clone git://128.224.159.140/demoCode
Initialized empty Git repository in /home/hyang0/aaaa/demoCode/.git/
remote: Counting objects: 54, done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 54 (delta 2), reused 0 (deremote: lta 0)
Receiving objects: 100% (54/54), 80.17 KiB, done.
Resolving deltas: 100% (2/2), done.

我的/wrgit下的目录结构:
bash$  tree /wrgit -L 2
/wrgit
`-- demoCode.git
|-- HEAD
|-- branches
|-- config
|-- description
|-- git-daemon-export-ok
|-- hooks
|-- info
|-- objects
`-- refs

6 directories, 4 files
bash$ 
bash$  cat /wrgit/demoCode.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = true
[daemon]
uploadpack = true
uploadarch = true
    receivepack = true
bash$ 

如果还不能正常工作,可以看看你的 repository 配置是否正确,可以加个 git-daemon-export-ok文件,或改改config 文件把 receivepack = true打开。

具体参数可以参看 man git-daemon, 这里就不赘述。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值