当前位置:   article > 正文

使用gitlab搭建私有仓库_gitlib怎么建私有仓

gitlib怎么建私有仓

我们想要搭建自己的私有仓库,更加快捷的来获得自己的项目和同步项目,我们该怎么做呢,这里我们可以自己搭建私有仓库,就需要使用gitlab

一、gitlab

环境:
          git:rhel7,用来搭建gitlab,建议多点内存,2g起步,gitlab比较吃内存

          jenkins:rhrl7,用来搭建jenkins

         软件:github,jenkins ==> 点击下载   提取码: wyxb

1.安装gitlab

[root@git gitlab]# yum install gitlab-ce-11.2.0-ce.0.el7.x86_64.rpm -y

2.设置gitlab

  1. [root@git gitlab]# vim /etc/gitlab/gitlab.rb
  2. external_url 'http://172.25.1.1'
  3. [root@git gitlab]# gitlab-ctl reconfigure ##重新配置gitlab

3.访问gitlab

我们再浏览器输入172.25.1.1,就可以访问到gitlab,第一次需要设置密码

设置完密码之后就可以登陆了

我们可以查看gitlab的状态

  1. [root@git gitlab]# gitlab-ctl status
  2. run: alertmanager: (pid 3829) 962s; run: log: (pid 3839) 962s
  3. run: gitaly: (pid 3783) 964s; run: log: (pid 3793) 964s
  4. run: gitlab-monitor: (pid 3802) 964s; run: log: (pid 3805) 963s
  5. run: gitlab-workhorse: (pid 3767) 965s; run: log: (pid 3775) 964s
  6. run: logrotate: (pid 3380) 1031s; run: log: (pid 3803) 963s
  7. run: nginx: (pid 3357) 1037s; run: log: (pid 3776) 964s
  8. run: node-exporter: (pid 3454) 1019s; run: log: (pid 3794) 964s
  9. run: postgres-exporter: (pid 3846) 962s; run: log: (pid 3852) 962s
  10. run: postgresql: (pid 3089) 1132s; run: log: (pid 3760) 965s
  11. run: prometheus: (pid 3814) 963s; run: log: (pid 3818) 963s
  12. run: redis: (pid 3029) 1143s; run: log: (pid 3759) 965s
  13. run: redis-exporter: (pid 3562) 1007s; run: log: (pid 3808) 963s
  14. run: sidekiq: (pid 3333) 1044s; run: log: (pid 3761) 965s
  15. run: unicorn: (pid 3295) 1050s; run: log: (pid 3762) 965s

4.建立私有仓库

首先新建私有仓库

然后点击头象菜单中的setting

添加ssh-key

ssh-key下面的方式查看

  1. [root@git gitlab]# cat ~/.ssh/id_rsa.pub
  2. ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQQi9pxhnrlC0GdtCP2hgd83azEI91kSaq1e5+29OM3jRB3hZpqyFeDIZQgfsu6xXCWRriwH9jXGlXR8P6jfc8Fm6ZBlT68EmVRxggSvZiMBxsHv6NTYekf7/VftlGIOAooKQfqkmTBy6rmrVgFN04QQDpAe77zzjfDiloF4TZXiybYUFjPTAXLj/IEW8gQlUupk7hWhjAtNHcua/qNmJNgiUFpTJUAow6/ynrep3as6LKq7fzW3uXLNj77jaQl4ddPZcyblmuRGibTs0np9pIDT4vilvV+4Sk9iyCEYkHDyKn2nnSwD/sRkZBjdcHNN/QaJtQF1wxZlzRsiX8GdrT root@git

添加成功截图

我们在gitlab的新建的项目里面新添加一个文件,然后通过克隆的方式下载到本地

  1. [root@git ~]# git clone git@172.25.1.1:root/nelws.git
  2. Cloning into 'nelws'...
  3. The authenticity of host '172.25.1.1 (172.25.1.1)' can't be established.
  4. ECDSA key fingerprint is 1d:2b:c0:f8:95:e1:0c:bd:5c:f7:f4:62:af:3e:8a:6f.
  5. Are you sure you want to continue connecting (yes/no)? yes
  6. Warning: Permanently added '172.25.1.1' (ECDSA) to the list of known hosts.
  7. remote: Enumerating objects: 3, done.
  8. remote: Counting objects: 100% (3/3), done.
  9. remote: Total 3 (delta 0), reused 0 (delta 0)
  10. Receiving objects: 100% (3/3), done.
  11. [root@git ~]# cd nelws/
  12. [root@git nelws]# ls
  13. README.md
  1. [root@git nelws]# touch test
  2. [root@git nelws]# echo test > test
  3. [root@git nelws]# git add test
  4. [root@git nelws]# git commit -m "add test"
  5. [master 35ac67f] add test
  6. 1 file changed, 1 insertion(+)
  7. create mode 100644 test
  8. [root@git nelws]# git push -u origin master
  9. Counting objects: 4, done.
  10. Compressing objects: 100% (2/2), done.
  11. Writing objects: 100% (3/3), 271 bytes | 0 bytes/s, done.
  12. Total 3 (delta 0), reused 0 (delta 0)
  13. To git@172.25.1.1:root/nelws.git
  14. 599e458..35ac67f master -> master
  15. Branch master set up to track remote branch master from origin.

接下来,我们在gitlab端查看

ok~

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/814415
推荐阅读
相关标签
  

闽ICP备14008679号