1.安装软件
[root@server1 gitlab]# yum install -y git
[root@server1 gitlab]# cd
[root@server1 ~]# mkdir demo
[root@server1 ~]# cd demo/
[root@server1 demo]# git init
Initialized empty Git repository in /root/demo/.git/
[root@server1 demo]# git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
#创建虚拟机机时内存最少给2G,否则安装过程很慢(亲身体会!别踩雷!)!
[root@server1 gitlab]# yum install -y gitlab-ce-11.2.0-ce.0.el7.x86_64.rpm


2.修改配置文件:
[root@server1 gitlab]# cd /etc/gitlab/
[root@server1 gitlab]# ls
gitlab.rb
[root@server1 gitlab]# vim gitlab.rb
13 external_url 'http://172.25.60.1'

[root@server1 gitlab]# gitlab-ctl reconfigure

3.打开浏览器:172.25.60.1
设置密码:长度不小于8字节:

root登录:

创建一个项目:


添加项目名称:


add an SSH key

[root@server1 gitlab]# ssh-keygen

[root@server1 ~]# cd .ssh/
[root@server1 .ssh]# ls
id_rsa id_rsa.pub
[root@server1 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6PNyLgJSs93xZnigdwCUKjZiG03OxruzZbLieUibl5IXJLlVPthRI/GLtw1tvAhTZbaCQCQ+5ikNyKkvD4v9mMAVmfIwqWipiYzZUWmuqRLXy8Edb5KdvDcE1ePbC+jYQP7cLypYK9hYs5bgQJmQn9nBhdnen0nBJMdT1cngYnypq1XUulsmHf/PauaSQUlgeP6ZGMLwq7qYEVHixec2b2eyNjok5rOKvoqJxhEklKGfYbrholVaX76hb8Gk3KAhwMdXtaf8g2vws2GcAO+bv5CmGkCZW18Sytd2ZJq173SxjRYruvqZQ34pDvReEUp04Gxm8KAk7jura6rT1sbDP root@server1

#把公钥复制到浏览器中:


4.
[root@server1 ~]# rm -fr demo/
[root@server1 ~]# git clone git@172.25.60.1:root/demo.git
Cloning into 'demo'...
The authenticity of host '172.25.60.1 (172.25.60.1)' can't be established.
ECDSA key fingerprint is ac:2b:aa:ab:fe:35:da:aa:ad:c7:7c:7b:e9:1b:22:67.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.25.60.1' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[root@server1 ~]#
[root@server1 ~]# cd demo/
[root@server1 demo]# ls
README.md
[root@server1 demo]# echo hello > hello.py
[root@server1 demo]# ls
README.md hello.py
[root@server1 demo]# git add hello.py
[root@server1 demo]# git config --global user.email "Fairy_Sue@126.com"
[root@server1 demo]# git config --global user.name "mktb"
[root@server1 demo]# git commit -m "m"
[master 7710251] m
1 file changed, 1 insertion(+)
create mode 100644 hello.py
[root@server1 demo]# git push -u origin master
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 271 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@172.25.60.1:root/demo.git
a258149..7710251 master -> master
Branch master set up to track remote branch master from origin.
[root@server1 demo]#
5.在浏览器上查看:




|