版本管理工具 Gitlab

这里写图片描述

与集中式的版本管理工具不同, git采用分布式的版本管理方式. 由于最为广泛使用的git的仓库github只提供public的免费版本,所以更适合开源项目的管理,priavte仓库收费加之数据保留在远端的服务方式,很多企业需要创建供自己使用的github,功能非常类似的gitlab此时就能派上用场了。

Docker pull

# docker pull docker.io/gitlab/gitlab-ce
  • 1

Docker run

事前准备

#mkdir -p /srv/gitlab/config /srv/gitlab/logs /srv/gitlab/data
  • 1

docker run

docker run --detach \
    --hostname host32 \
    --publish 443:443 --publish 80:80 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
本地路径 容器内路径 说明
/srv/gitlab/data /var/opt/gitlab gitlab仓库数据
/srv/gitlab/logs /var/log/gitlab log信息
/srv/gitlab/config /etc/gitlab gitlab设定文件

登陆画面

这里写图片描述

登陆后画面
这里写图片描述

创建Group

这里写图片描述

创建后

这里写图片描述

创建Project

这里写图片描述

创建后

这里写图片描述

创建一个Readme文件

这里写图片描述

设定gitlab的ssh连接

本地的ssh的public key的内容(如果没有请用ssh-keygen生成)

[root@host32 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4D2H3/kkuRAb88tGyB83pvc0lGTEyOUa2nE4Lzi8YXC+7/o4oG3EQrhTNIMuMAh81ZqmdTwLNbI5yk6Q4GHkRpClYneX3yg7YG6uD2kJWeCAYDOFxPwB/HxvT9swhb5x3ZZXQ1bTLSS1SBxp6Fh5zQS8wkM/Ql1w9YPWx8+OY4VVa8CuhiCRpagM7fGhWjUH63MugGHiT5Ku7Ef6KvinK8ajES7K3EOkMm8noBYp0Da5D2Ggy6+dP7hrpv4XIQDe+lHfdC8eWhXW3kLY1bclLGq2I82S3+P0uzPgo437SDbj0+9JGg9clUTSnZBFUd6eO5WejgjgEmqTSw9/U10UD root@host32
[root@host32 ~]#
  • 1
  • 2
  • 3

设定gitlab的ssh

这里写图片描述

这里写图片描述

使用git 与gitlab连接

使用git clone连接到gitlab

[root@host32 ~]# git clone http://192.168.32.32/devgroup/pilotproject.git
Cloning into 'pilotproject'...
Username for 'http://192.168.32.32': root
Password for 'http://[email protected]':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
[root@host32 ~]# ls -l pilotproject/
total 4
-rw-r--r--. 1 root root 5 Aug  6 06:20 README.md
[root@host32 ~]# cat pilotproject/README.md
hello[root@host32 ~]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

更新信息

[root@host32 ~]# cd pilotproject/
[root@host32 pilotproject]# ll
total 4
-rw-r--r--. 1 root root 5 Aug  6 06:20 README.md
[root@host32 pilotproject]# cat README.md
hello[root@host32 pilotproject]# echo "updated..." >>README.md
[root@host32 pilotproject]# cat README.md
helloupdated...
[root@host32 pilotproject]# git add README.md
[root@host32 pilotproject]# git commit -m "update"
[master a26e6f7] update
 1 file changed, 1 insertion(+), 1 deletion(-)
[root@host32 pilotproject]# git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'http://192.168.32.32': root
Password for 'http://[email protected]':
Counting objects: 5, done.
Writing objects: 100% (3/3), 247 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.32.32/devgroup/pilotproject.git
   f5b9ccd..a26e6f7  master -> master
[root@host32 pilotproject]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

从gitlab上确认更新的内容

这里写图片描述

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自www.cnblogs.com/firsttry/p/10294131.html