一、版本控制概念
本地版本控制系统
集中化版本控制系统CVS、subversion(SVN)
分布式版本控制系统
二、Gitlab15部署
2.1 gitlab15版本的部署方法
重新配置文件权限,这个时间会比较长
sudo gitlab-ctl reconfigure
访问
http://192.168.238.136:8100
#这里IP是上面自己/etc/gitlab/gitlab.rb 配置的IP和端口;这里也可以配置远程邮箱
配置邮箱方法
Gitlab账户root
默认密码cat /etc/gitlab/initial_root_password
三、使用Gitlab
3.1 配置密钥
ssh-keygen
[root@zabbix_server ~]# cd .ssh/
[root@zabbix_server .ssh]# ls
id_rsa id_rsa.pub known_hosts
[root@zabbix_server .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTEpFs+VWUzB77EB+YY7hAfl2UYjKQhU+yIYkt/b1zLKEKhcwB8/XPCyxmaf93VFm9riyEKGNffCs6Ois4fIqJ5/aGZv2YlaWPket3Vr4KTEZugkw3BoC+liYEbF3XJ5kxAQPcwND0M91t48Zr7t+dVVacFC0mpXARkmpP1IkE2ZKaRUBj0IZmh5tImTFuWG3KktUOYyW4c1fDbM/2xsqT2AplaH8TDvDbxZ2F5PbmBRLwa9iK2CWywwD2nBWJILQ+zx72FDsV+1XMmCEheWrDP/17Xszv+jlJAZic9RJaONiKf3f5A4s+7tHgDeMayx6lfUC+EEXXG1cp56fg8h11 root@zabbix_server
远程连接配置
#域名解析
vim /etc/hosts
192.168.238.136 ggitlab.com
#配置git环境
#config:参数是用来配置git环境的
#--global:长命令表示配置整个git环境
git config --global user.name "git"
git config --global user.email "git@localhost"
#测试连接是否成功
[root@zabbix_server ~]# ssh -T git@192.168.238.136
Welcome to GitLab, @root!
#克隆服务器文件
git config --global user.name "git"
git config --global user.email "git@localhost"
git clone git@localhost:root/`project.git`
#这个project,为图形界面创建项目文件,是把这个项目下文件下载到本地root/下
#上传文件
#创建本地空仓库git init
#创建目录
mkdir test
#进入目录
cd test
#新建文件
333.sh
#初始化
git init
`初始化后ls看不到,需要使用ls -ah`
[root@zabbix_server test]# ls -ah
. .. .git
cd .git
[root@zabbix_server .git]# ls
branches config description HEAD hooks info objects refs
cd
3.2 远程连接
[root@zabbix_server test]# git remote add origin git@ggitlab.com:root/test.git
[root@zabbix_server test]# git add . #建立当前文件夹下的所有文件,准备上传
`新建文件添加到本地仓库git add、git commit -m
add:将文件添加到缓存区
commit:提交到本地仓库`
#对文件的添加文件的描述
[root@zabbix_server my-cloud1]# git commit -m 'first commmit'
[master(根提交) 67c6127] first commmit
1 file changed, 1 insertion(+)
create mode 100644 333.sh
#上传文件
[root@zabbix_server my-cloud1]# git push -u origin master
The authenticity of host 'ggitlab.com (192.168.238.136)' can't be established.
ECDSA key fingerprint is SHA256:eekrOL+XFDfM0g3CuES4L5nG5gxCQDwPz7dNoi5VEOU.
ECDSA key fingerprint is MD5:54:c6:a0:e1:13:d8:27:25:04:76:d7:33:cf:b8:fb:ab.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ggitlab.com' (ECDSA) to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 206 bytes |