填充颜色无为什么还是绿色的,桌面背景颜色不是绿色的,也没有开护眼模式
629
2022-05-29
写在前面
有时候可能做项目组长,负责一个项目开发,但是工作是内网,也没有公司的版本库权限,那这个时候,我们怎么用处理版本控制,可以用集中式的版本库工具SVN,或者分布式的Git,这里和小伙伴分享如何搭建自己的Git中文版本库。
前提条件: 一台可以连接外网的Linux或者Windows机器,当然可以是虚机或者ESC之类。或者只要可以装Docker的机器就可以。
我深怕自己本非美玉,故而不敢加以刻苦琢磨,却又半信自己是块美玉,故有不肯庸庸碌碌,与瓦砾为伍。于是我渐渐地脱离凡尘,疏远世人,结果便是一任愤懑与悔恨日益助长内心那怯弱的自尊心。其实任何人都是驯兽师,而那野兽,无非就是各人的性情而已。 -----中岛敦《山月记》
服务器: liruilongs.github.io:192.168.26.55
一、docker 环境安装
┌──[root@liruilongs.github.io]-[~] └─$ yum -y install docker-ce ┌──[root@liruilongs.github.io]-[~] └─$ systemctl enable docker --now
配置docker加速器
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://2tefyfv7.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
二、安装GitLab
1.安装GitLab 并配置
拉取镜像
┌──[root@liruilongs.github.io]-[~] └─$ docker pull beginor/gitlab-ce
2.创建共享卷目录
创建共享卷目录,用于持久化必要的数据和更改相关配置
┌──[root@liruilongs.github.io]-[~] └─$ mkdir -p /data/gitlab/etc/ /data/gitlab/log /data/gitlab/data ┌──[root@liruilongs.github.io]-[~] └─$ chmod 777 /data/gitlab/etc/ /data/gitlab/log /data/gitlab/data
3.创建 Gitlab 容器
这里的访问端口一定要要设置成80,要不push项目会提示没有报错,如果宿主机端口被占用,需要把这个端口腾出来
┌──[root@liruilongs.github.io]-[~] └─$ docker run -itd --name=gitlab --restart=always --privileged=true -p 8443:443 -p 80:80 -p 222:22 -v /data/gitlab/etc:/etc/gitlab -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/data:/var/opt/gitlab beginor/gitlab-ce acc95b2896e8475915275d5eb77c7e63f63c31536432b68508f2f216d4fec634 ┌──[root@liruilongs.github.io]-[~] └─$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES acc95b2896e8 beginor/gitlab-ce "/assets/wrapper" 53 seconds ago Up 51 seconds (health: starting) 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:222->22/tcp, :::222->22/tcp, 0.0.0.0:8443->443/tcp, :::8443->443/tcp gitlab ┌──[root@liruilongs.github.io]-[~] └─$ ┌──[root@liruilongs.github.io]-[~] └─$#
4.关闭容器修改相关配置文件
┌──[root@liruilongs.github.io]-[~] └─$ docker stop gitlab gitlab
external_url 'http://192.168.26.55’
┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep external_url ##! For more details on configuring external_url see: # external_url 'GENERATED_EXTERNAL_URL' # registry_external_url 'https://registry.gitlab.example.com' # pages_external_url "http://pages.example.com/" # gitlab_pages['artifacts_server_url'] = nil # Defaults to external_url + '/api/v4' # mattermost_external_url 'http://mattermost.example.com' ┌──[root@liruilongs.github.io]-[~] └─$ sed -i "/external_url 'GENERATED_EXTERNAL_URL'/a external_url\t'http://192.168.26.55' " /data/gitlab/etc/gitlab.rb ┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep external_url ##! For more details on configuring external_url see: # external_url 'GENERATED_EXTERNAL_URL' external_url 'http://192.168.26.55' # registry_external_url 'https://registry.gitlab.example.com' # pages_external_url "http://pages.example.com/" # gitlab_pages['artifacts_server_url'] = nil # Defaults to external_url + '/api/v4' # mattermost_external_url 'http://mattermost.example.com' ┌──[root@liruilongs.github.io]-[~] └─$
gitlab_rails[‘gitlab_ssh_host’] = '192.168.26.55’
┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep gitlab_ssh_host # gitlab_rails['gitlab_ssh_host'] = 'ssh.host_example.com' ┌──[root@liruilongs.github.io]-[~] └─$ sed -i "/gitlab_ssh_host/a gitlab_rails['gitlab_ssh_host'] = '192.168.26.55' " /data/gitlab/etc/gitlab.rb ┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep gitlab_ssh_host # gitlab_rails['gitlab_ssh_host'] = 'ssh.host_example.com' gitlab_rails['gitlab_ssh_host'] = '192.168.26.55' ┌──[root@liruilongs.github.io]-[~] └─$
gitlab_rails[gitlab_shell_ssh_port] = 222
┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep gitlab_shell_ssh # gitlab_rails['gitlab_shell_ssh_port'] = 22 ┌──[root@liruilongs.github.io]-[~] └─$ sed -i "/gitlab_shell_ssh_port/a gitlab_rails['gitlab_shell_ssh_port'] = 222" /data/gitlab/etc/gitlab.rb ┌──[root@liruilongs.github.io]-[~] └─$ cat /data/gitlab/etc/gitlab.rb | grep gitlab_shell_ssh # gitlab_rails['gitlab_shell_ssh_port'] = 22 gitlab_rails[gitlab_shell_ssh_port] = 222 ┌──[root@liruilongs.github.io]-[~] └─$
/data/gitlab/data/gitlab-rails/etc/gitlab.yml
┌──[root@liruilongs.github.io]-[~] └─$ vim /data/gitlab/data/gitlab-rails/etc/gitlab.yml ┌──[root@liruilongs.github.io]-[~] └─$ ############################## gitlab: ## Web server settings (note: host is the FQDN, do not include http://) host: 192.168.26.55 port: 80 https: false
修改完配置文件之后。直接启动容器
┌──[root@liruilongs.github.io]-[~] └─$ docker start gitlab
三、新建项目,push代码测试
PS F:\blogger> git init Initialized empty Git repository in F:/blogger/.git/ PS F:\blogger> git config --global user.name "Administrator" PS F:\blogger> git config --global user.email "admin@example.com" PS F:\blogger> git remote add origin http://192.168.26.55/root/blog.git PS F:\blogger> git add . PS F:\blogger> git commit -m "Initial commit" PS F:\blogger> git push -u origin master Enumerating objects: 322, done. Counting objects: 100% (322/322), done. Delta compression using up to 8 threads Compressing objects: 100% (302/302), done. Writing objects: 100% (322/322), 11.31 MiB | 9.22 MiB/s, done. Total 322 (delta 24), reused 0 (delta 0) remote: Resolving deltas: 100% (24/24), done. To http://192.168.26.55/root/blog.git * [new branch] master -> master Branch 'master' set up to track remote branch 'master' from 'origin'. PS F:\blogger>
时间原因,关于 【搭建自己的中文Git版本库】先分享到这里。生活加油 ^ _ ^
Git 容器
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。