搭建无限制权限的简单git服务器使用git-daemon脚本
如果想要用ubantu架设无限制权限(即不适用gitosis)的简单git服务器,实现git库下载clone,push等简单的基本功能,
可以直接使用git-daemon脚本(非常不安全,建议项目代码的git管理不要使用!)
本地安装完sudo apt-get install git git-core之后没有安装git-daemon-run或者git-daemon-sysvinit时,可以执行如下操作:
sudo vi /etc/init.d/git-daemon
==========================================CP下面的代码复制过去,修改下base-path和user==================================
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=git-daemon
PIDFILE=/var/run/$NAME.pid
DESC="the git daemon"
DAEMON=/usr/lib/git-core/git-daemon
DAEMON_OPTS="--base-path=/home/dongwuming/git --enable=receive-pack --export-all --verbose --syslog --detach --pid-file=$PIDFILE --user=dongwuming --group=nogroup"
test -x $DAEMON || exit 0
[ -r /etc/default/git-daemon ] && . /etc/default/git-daemon
. /lib/lsb/init-functions
start_git() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--startas $DAEMON -- $DAEMON_OPTS
}
stop_git() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE
rm -f $PIDFILE
}
status_git() {
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE >/dev/null 2>&1
}
case "$1" in
start)
log_begin_msg "Starting $DESC"
start_git
log_end_msg 0
;;
stop)
log_begin_msg "Stopping $DESC"
stop_git
log_end_msg 0
;;
status)
log_begin_msg "Testing $DESC: "
if status_git
then
log_success_msg "Running"
exit 0
else
log_failure_msg "Not running"
exit 1
fi
;;
restart|force-reload)
log_begin_msg "Restarting $DESC"
stop_git
sleep 1
start_git
log_end_msg 0
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
======================================:wq!保存退出=============================================
sudo chmod 777 /etc/init.d/git-daemon
sudo /etc/init.d/git-daemon stop
sudo /etc/init.d/git-daemon start
ps -ef | grep git-daemon
1000 6100 1 0 17:01 ? 00:00:00 /usr/lib/git-core/git-daemon --base-path=/home/dongwuming/git --enable=receive-pack --export-all --verbose --syslog --detach --pid-file=/var/run/git-daemon.pid --user=dongwuming --group=nogroup
1000 6243 17377 0 17:29 pts/2 00:00:00 grep --color=auto git-daemon
OK 用另外一台局域网的机器
git clone git://192.168.xx.xx/your-bare-or-mirror-git-repositories【建库的时候一定要是一个bare赤裸的或者mirror镜像的git库】
cd your-bare-or-mirror-git-repositories
vi test
just a test!
git add.;git commit -m "just a test"
git push origin HEAD:master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git://192.168.50.125/test
6ca6f70..9b97ad9 master -> master
OK了
git-daemon中控制用户可以PUSH的权限的参数为:
--enable=receive-pack
====================================UBANTU sudo apt-gt install git-daemon=========================================
直接下载git-daemon 来管理git
$apt-get install git git-core git-daemon-run
配置git-daemon-run
$vi /etc/sv/git-daemon/run
====================
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -m64000000 /
git-daemon --verbose --base-path=/var/cache/git /var/cache/git --enable=receive-pack --export-all --verbose --syslog --detach 【根据个人需求修改配置】
启动git-daemon
$sudo sv stop git-daemon
$sudo sv start git-daemon
搭建无限制权限的简单git服务器使用git-daemon脚本的更多相关文章
- Windows下搭建Git 服务器: BONOBO GIT SERVER + TortoiseGit
本文将介绍如何在Windows操作系统下搭建Git服务器和客户端.服务器端采用的是Bonobo Git Server,一款用ASP.NET MVC开发的Git源代码管理工具,界面简洁,基于Web方式配 ...
- 不搭建git服务器对git仓库进行局域网内共享多人合作开发项目
有时候在一个临时局域网内没有搭建git服务器,但是又想多人开发一个项目,此时只要每个人电脑安装有git客户端,参考一下方法即可尝试建一个本地化的远程仓库进行多人开发工作. 远程仓库通常只是一个裸仓库( ...
- 搭建Git服务器环境----Git hooks代码自动部署
引言:自己想搭一套git的服务端环境,不想用github码云等.经多方资料整合,实验总结,以下是亲测有效的方式.可用于公司日常开发 一.搭建Git环境 ① 安装 Git Linux 做为服务器端系统, ...
- Git服务器和Git权限管理应用GITLAB安装方法
首先声明,本文使用的服务器是Centos 6.5,在其他版本的LINUX上运行不保证也是一样的效果. 顺便说下 来波点赞 来波收藏和推荐 有什么问题 我会一直关注评论的 想放一张最终图吧 其中主要涉 ...
- (转)初学Git及简单搭建git服务器和客户端
终于搞定,mac自己作为git服务器,mac也是客户端,如何免登 从另外一个linux服务器的上传公钥得到提示 ssh-copy-id -i ~/.ssh/id_rsa.pub git@192.168 ...
- 项目实践中--Git服务器的搭建与使用指南(转)
一.前言 Git是一款免费.开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理.在平时的项目开发中,我们会使用到Git来进行版本控制. Git的功能特性: 从一般开发者的角度来 ...
- Ubuntu中Git服务器搭建
git服务器搭建过程 参考网上资料搭建git服务器过程记录 如下: 需求 硬件需求:一台Ubuntu或者debian电脑(虚拟机),能通过网络访问到. 软件需求:git-core, gitosis, ...
- 项目实践中--Git服务器的搭建与使用指南
一.前言 Git是一款免费.开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理.在平时的项目开发中,我们会使用到Git来进行版本控制. Git的功能特性: 从一般开发者的角度来 ...
- Windows/Linux 环境搭建Git服务器 + vs2012集成git
1. 下载.安装Git 我的系统是Windows 7,需要安装Git for Windows. 下载地址: http://code.google.com/p/msysgit/downloads/lis ...
随机推荐
- Volume rendering
Volume rendering Reconstruction filter UCDAVIS
- SQL截取字符串函数
A.截取从字符串左边开始N个字符 以下是代码片段: Declare @S1 varchar(100) Select @S1='http://www.xrss.cn' Select Left( ...
- CAM350测量
CAM350 测量方法 1. 单位设置:在菜单:Settings 下选中 Unit: 英制 公制 精确度 CAM350 软件默认的是英制,不习惯用英制的人,就改为公制的呀 软件默认的是英制 就改为公制 ...
- 手机大数据_SQL映射对象_动软_代码模板_Models
<#@ template language="c#" HostSpecific="True" #> <#@ output extension= ...
- bootstrap学习之二-组件
一.bootstrap字体图标 以span的形式出现,通常可以用于一个button或者其他元素的内文本, <span class="glyphicon glyphicon-sort-b ...
- ADB 在 Android SDK 的中的路径
以前 adb.exe 是在 sdk/tools 目录下 现在 安装 sdk 之后, 需要打开 SDK Manager 下载 `Android SDK Platform-tools` 然后, 在 sdk ...
- 如何调试DLL组件
因为DLL组件不像EXE是程序的入口,所以DLL需要其他进程的调用才能调试. 1.首先在DLL项目中你想调试的位置打好断点. 2.如果已经有一个进程,比如foo.exe已经启动,那么就用:调试> ...
- The Struts dispatcher cannot be found. This is usually caused by using Strut
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the assoc ...
- 查看oracle 数据库的DBID
(1)使用rman查看$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jun 12 03:20:19 2 ...
- eclipse下部署web工程的两种方式
习惯了Eclipse 的开发,就觉得不想那么懒去用MyEclipse傻瓜式的部署工程. 第一种,手动部署工程. 情况一:如果工程目录在tomcat目录的webapp目录下,这种情况就不需要有工程部署的 ...