搭建自己的git服务器
来源:互联网 发布:淘宝网能买到处方药吗 编辑:程序博客网 时间:2024/05/29 13:52
参考了很多别人的文章,最终折腾成功。中间出现各种应为配置导致的错误,泪奔···别人博客的配置应该是可以用,可是自己用了才知道自己是多么的天真。没搞懂apache2配置,先将就用着吧。
Git服务器搭建与维护
一、搭建git服务
环境:ubuntu
1)安装git与apache2:
apt-get install git git-core apache2 apache2-utils
2)加载apache2模块
a2enmod rewrite dav_fs cgi alias env
- 建立仓库
仓库建立在/var/www/git 路径之下
mkdir –p /var/www/git/test_repocd /var/www/git/test_repogit init –bare ; cp hooks/post-update.sample hooks/post-updategit update-server-infocd /var/www/git ; chown www-data:www-data –R test_repo
2.添加用户名
用户名文件保存在/var/www/git路径
htpasswd –c –b htpasswd name pwd
ps:-c用于建立用户名文件,若是htpasswd已经建立,则不需要-c
-b 显式添加用户名与密码
3.修改apache2配置文件
编辑apache2配置文件,设置git repository路径并关联用户名
vim /etc/apache2/sites-enabled/000-default.conf<VirtualHost 192.168.0.28:80> #192.168.0.28位服务器IP地址DocumentRoot /var/www/git #git仓库路径ServerName 192.168.0.28LoadModule dav_fs_module modules/mod_dav_fs.so <Directory "/var/www/git">Dav onAllow from AllOptions +ExecCGIAllowOverride AllAuthUserFile "/var/www/git/htpasswd" #将仓库与用户名关联Require valid-user</Directory><Location /git/test_repo> #/TC为/var/www/git 目录下的仓库名称 AuthType Basic AuthName "Private Git Access" AuthUserFile "/var/www/git/htpasswd" #将仓库与用户名关联 Require valid-user</Location>SetEnv GIT_HTTP_EXPORT_ALLSetEnv GIT_PROJECT_ROOT /var/www/gitScriptAlias /git /usr/lib/git-core/git-http-backend</VirtualHost>
配置完成后重启服务器/etc/init.d/apache2 restart
二、git server维护
- 服务器ip地址有变动
修改配置文件
vim /etc/apache2/sites-enabled/000-default.confVirtualHost 192.168.0.28:80 #192.168.0.28位服务器IP地址DocumentRoot /var/www/git ServerName 192.168.0.28 #192.168.0.28位服务器IP地址
2.建立新的仓库
建仓具体操作如同第一章节搭建git服务器中一样,建新的仓库后需要在配置文件中添加一下内容
vim /etc/apache2/sites-enabled/000-default.conf
<Location /git/new_repo > #/TC为/var/www/git 目录下的仓库名称 AuthType Basic AuthName "Private Git Access" AuthUserFile "/var/www/git/htpasswd" #将仓库与用户名关联 Require valid-user</Location>
重启apache2服务 /etc/init.d/apache2 restart
3.添加新的用户
htpasswd –b /var/www/git/htpasswd new-name passwd
0 0
- 搭建自己的Git服务器
- 搭建自己的Git服务器
- 搭建自己的Git服务器
- 搭建自己的git服务器
- 搭建自己的git服务器
- 自己搭建git服务器
- 搭建自己的git 代码服务器
- 搭建自己的Git服务器失败了
- 搭建自己的git 代码服务器
- deepin下搭建自己的git服务器
- centos 搭建自己的git服务器
- 如何搭建属于自己的git服务器
- 搭建自己的git服务器 gitlib
- Linux下搭建自己的Git服务器
- 使用 Gogs 搭建自己的 Git 服务器
- 在ProjectLocker上搭建自己的GIT服务器
- 在CentOS下搭建自己的Git服务器
- 在CentOS下搭建自己的Git服务器
- 基于 Jenkins 快速搭建持续集成环境
- 中文乱码问题
- JSP_运维_域名与项目绑定
- android中handler使用WeakReference防止内存泄露
- input type=file 上传图片并显示
- 搭建自己的git服务器
- 关于多线程可见性学习后理解记录
- Android系统加速度传感器数据-手机坐标系转成地面坐标系
- Win8系统的Myeclipse远程连接Hadoop配置
- Deep Learning-TensorFlow (11) CNN卷积神经网络_解读 VGGNet
- visual studio技巧总结
- 动态规划(1)0-1背包同类型习题
- C++引用C的静态库
- 写给初学者16_android_常用控件_ListView