Git服务器
git服务器
一、ssh协议
密码认证访问
-服务器安装git
-使用git命令初始化版本仓库
-客户端使用ssh远程访问
[[email protected] ~]# git init --bare /var/lib/git/ssh
[[email protected] ~]# vim /etc/gitweb.conf//设置仓库根目录
第10行的位置添加
…
$projectroot = “/var/lib/git”;
…
[[email protected] ~]# git clone [email protected]:/var/lib/git/ssh
二、免密远程Git服务器(秘钥授权)
-客户端生成ssh秘钥
-将秘钥拷贝给Git服务器
-测试上传,上传代码到远程服务器
[[email protected] ~]# ssh-****** -f /root/.ssh/id_rsa -N ‘’
[[email protected] ~]# ssh-copy-id 192.168.4.15
[[email protected] ~]# git push
三、Git协议
Git 协议访问支持无授权访问
服务器安装git-daemon软件包
服务器初始化仓库(必须要在/var/lib/git/目录创建仓库)
服务器启动Git服务
客户端使用git协议访问(读写)
[[email protected] ~]# yum -y install git-daemon
[[email protected] ~]# git init --bare /var/lib/git/bash_git
[[email protected] ~]# vim /usr/lib/systemd/system/[email protected]
四、HTTP协议
支持浏览器访问
-服务器安装gitweb软件
-修改配置文件,设置仓库根目录
启动httpd
[[email protected] ~]# yum -y install httpd
[[email protected] ~]# yum -y install gitweb
[[email protected] ~]# systemctl start httpd
[[email protected] ~]# systemctl start git.socket
五、客户端浏览
http://192.168.4.15/git/