搭建git web服务器搭建
1、 安装并配置必要的依赖关系
sudo yum install-y curl policycoreutils-python openssh-serversudo systemctlenable sshdsudo systemctlstartsshd sudofirewall-cmd --permanent --add-service=httpsudo systemctl reloadfirewalld
2、 添加Gitlab软件包存储库并安装软件包
添加gitlab包存储库:
curlhttps://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh| sudo bash
接下来,安装GitLab包
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee
如果下载特别慢可以直接电脑下载上传:https://packages.gitlab.com/gitlab/gitlab-ee/我是下载的如下:
然后在执行安装:
yum install -y gitlab-ee
3、 修改gitlab网址
vi /etc/gitlab/gitlab.rbexternal_url‘http://gitlab.example.com‘修改
重新配置reconfigure
gitlab-ctlreconfigure
4、 启动gitlab服务
gitlab-ctl start 启动 gitlab-ctl stop 停止gitlab-ctl restart 重启
5、 浏览器浏览
http://192.168.6.7
默认用户名是root,首次访问让设置root用户密码;设置后即可登录。
6、 私用的服务器建议关闭注册
如下图,把打钩去掉,记住一共有两个sign-up enabled;关闭第一个,第二个是登录用的。
650) this.width=650;" src="https://s5.51cto.com/oss/201710/23/f3417af57e03ec17d44ca6917429fc04.png-wh_500x0-wm_3-wmp_4-s_1071311435.png" title="111.png" alt="f3417af57e03ec17d44ca6917429fc04.png-wh_" />
7、 汉化gitlab
停止gitlab
gitlab-ctl stop
查看gitlab版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
650) this.width=650;" src="https://s3.51cto.com/oss/201710/23/7288c3839d94fec42e27bb4f53af2993.png-wh_500x0-wm_3-wmp_4-s_252217363.png" title="222.png" alt="7288c3839d94fec42e27bb4f53af2993.png-wh_" />
下载对应的汉化包
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.4-zh
查看该汉化补丁的版本是否是v10.0.4:
cat gitlab/VERSION
比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
cd gitlab
sudo git diff v10.0.4 v10.0.4-zh > ../10.0.4-zh.diff
将10.0.4-zh.diff作为补丁更新到gitlab中
回到root目录
cd
yum -y install patch –y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 <10.0.4-zh.diff
8、 启动gitlab
gitlab-ctl start
9、 浏览器浏览
650) this.width=650;" src="https://s2.51cto.com/oss/201710/23/bd66314b22ae97cbc5f7b382701eb20f.png-wh_500x0-wm_3-wmp_4-s_2091321436.png" title="333.png" alt="bd66314b22ae97cbc5f7b382701eb20f.png-wh_" />
650) this.width=650;" src="https://s3.51cto.com/oss/201710/23/77b490ac14a01ca59d0570bc8b88f4bf.png-wh_500x0-wm_3-wmp_4-s_506663605.png" title="444.png" alt="77b490ac14a01ca59d0570bc8b88f4bf.png-wh_" />
10、创建gitlab项目
650) this.width=650;" src="https://s4.51cto.com/oss/201710/23/ad14d3516f941c59cb2fab4151a21fc2.png-wh_500x0-wm_3-wmp_4-s_2242182912.png" title="555.png" alt="ad14d3516f941c59cb2fab4151a21fc2.png-wh_" />
11、客户端克隆并发布项目文件
客户端安装git
yum –y install git
配置全局name和email
git config --global user.name "root"
git config --global user.email "11111111@qq.com"
客户端生成相应公钥和私钥
ssh-keygen -t rsa -C 11111111@qq.com
将公钥内容复制到gitlab的用户的ssh key中
650) this.width=650;" src="https://s3.51cto.com/oss/201710/23/cffc87f65b79089f5aa390d4bb45c3cc.png-wh_500x0-wm_3-wmp_4-s_2308173030.png" title="666.png" alt="cffc87f65b79089f5aa390d4bb45c3cc.png-wh_" />
12、客户端克隆并发布项目文件
克隆仓库
git clone http://221.122.60.125/root/testtest.git
进入仓库文件夹testtest
cd testtestgit init 设置成仓库
创建项目文件
touch test01 test02mkdir abctouch abc/test01 abc/test02
上传文件到项目
git add . # 点 代表上传所有文件及文件夹git commit –m “ push test and abc” #提交上传的文件到缓存区,并设置描述git push –u origin master #推送上传文件到远程仓库
浏览器查看是否上传成功
650) this.width=650;" src="https://s1.51cto.com/oss/201710/23/32bfc5d9b6820fd83266ef0b4f14166a.png-wh_500x0-wm_3-wmp_4-s_2577216993.png" title="777.png" alt="32bfc5d9b6820fd83266ef0b4f14166a.png-wh_" />
13、 删除testtest文件,重新下载git项目,验证刚才是否发布成功。
650) this.width=650;" src="https://s3.51cto.com/oss/201710/23/0c41f82eb111723ef154ef034222cabb.png-wh_500x0-wm_3-wmp_4-s_1432116738.png" title="888.png" alt="0c41f82eb111723ef154ef034222cabb.png-wh_" />
本文出自 “506554897” 博客,请务必保留此出处http://506554897.blog.51cto.com/2823970/1975245
搭建git web服务器搭建
原文地址:http://506554897.blog.51cto.com/2823970/1975245