1. Gitlab简介

  Gitlab:代码私有仓库,可以使用Git进行代码的管理。

  GitHub:公共仓库。

  GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。

  可通过Web界面进行访问公开的或者私人项目。它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用。

  可以将Gitlab理解为一个大型的容器,将代码一块一块的存放到其中,从远程进行连接使用,进行克隆或者下载。

  管理的命令

    gitlab-ctl stop
    gitlab-ctl start
    gitlab-ctl restart

2. Gitlab的安装使用

1> 上传二进制压缩包

[root@localhost ~]# rz
[root@localhost ~]# ls
anaconda-ks.cfg gitlab-ce-8.9.-ce..el7.x86_64.rpm STXINWEI.TTF work_git

2> 安装本地文件包

[root@localhost ~]# yum localinstall -y gitlab-ce-8.9.-ce..el7.x86_64.rpm #localinstall命令用来安装本地的rpm包
……..
Installed:
gitlab-ce.x86_64 :8.9.-ce..el7

3> 更改Gitlab配置文件,更改Gitlab的ip

[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.16.4' #修改为主机的ip地址

4> 重新配置,此处将内存改大一点,可以很快的完成配置。此处需要几分钟

[root@localhost ~]# gitlab-ctl reconfigure
Running handlers:
Running handlers complete
Chef Client finished, / resources updated in minutes seconds
gitlab Reconfigured!

题外话:以后搭建OpenStack内存不够用将swap分区改大一点

5> 配置完成后关掉占用80端口的服务,在windows端输入主机地址进行查看

[root@localhost ~]# ss -tnl
……
LISTEN ::: :::*
[root@localhost ~]# systemctl stop httpd

  简单起见密码为12345678,密码少于八位无法通过。

  密码修改完成后进入注册界面。

  进入Gitlab,可以使用了。

  点击new project,创建新项目。

  创建项目名称,选择公共的Gitlab,点击create project创建项目。

3. Gitlab项目使用

1> 创建Gitlab使用目录

[root@localhost ~]# mkdir gitlab_test
[root@localhost ~]# cd gitlab_test/
[root@localhost gitlab_test]#

2> 克隆远程仓库至本地

[root@localhost gitlab_test]# git clone http://192.168.16.4/root/Github_test.git   # 地址为项目的http地址
Cloning into 'Github_test'...
warning: You appear to have cloned an empty repository.
[root@localhost gitlab_test]# ls
Github_test # 项目名称

3> 编辑文本信息进行推送

[root@localhost gitlab_test]# cd Github_test/
[root@localhost Github_test]# ls -a
. .. .git #含有git文件
[root@localhost Github_test]# touch zxj
[root@localhost Github_test]# echo "this is gitlab test contents" >> zxj #写入内容

4> 提交

[root@localhost Github_test]# git add .
[root@localhost Github_test]# git commit -m v1
[master (root-commit) 71cd526] v1
file changed, insertion(+)
create mode zxj

5> 进行远程推送

[root@localhost Github_test]# git push -u origin master    #远程的、分支
Username for 'http://192.168.16.4': root #用户
Password for 'http://root@192.168.16.4': #密码
Counting objects: , done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To http://192.168.16.4/root/Github_test.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
[root@localhost Github_test]#

6> Gitlab仓库查看

  可以看到更新的v1版本

  写入的文件

4. Linux中免密使用Gitlab

1> 生成秘钥

root@localhost Github_test]# ssh-keygen

2> 复制公钥信息

[root@localhost Github_test]# cat /root/.ssh/id_rsa.pub #公钥文件
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDARohqXBK+mnUVAzScFeQxNnWWo96el0wieiUD6WND2U7j/T121obOLqPHrCsTjWP6GYytfqunHi5DC8zEcpJtx73VWgoMbMAavgFL1Cp29nak8qKcUcXLp5M8upxBr0zaM7vsKYgAkTUbUwfG+iPxA6Mk6106NuU9hcjNlkfHGtOUMaM7OllrsDFjBDTmwyONNszJxROXwfxrxOrdhlVhOf30MckIHV+24E63q+UL8DdO34mmSf8Ah2wBGhTJvz1yevqa0TWd3gBO0daZMT/5AWQR9iAHVDON0vKfSsSiG6h7XAiEjryxwn8ZZintJj6NEvYGgOxGgaLsEmc+Ch7v root@localhost.localdomai

3> 把公钥复制到Gitlab中

回到项目。

  获取ssh地址,利用ssh免密登录

[root@localhost zxj2]# git clone git@192.168.16.4:root/Github_test.git
[root@localhost zxj2]# cd Github_test/
[root@localhost Github_test]# ls
zxj
[root@localhost Github_test]# echo "123_ssh" >> test
[root@localhost Github_test]# cat test
123_ssh
[root@localhost Github_test]# ls
test zxj
[root@localhost Github_test]# git add .
[root@localhost Github_test]# git commit -m v3
[master 46ecdf7] v3
file changed, insertion(+)
create mode test
[root@localhost Github_test]# git push origin master #直接推送,不再需要用户、密码
Counting objects: , done.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To git@192.168.16.4:root/Github_test.git
71cd526..46ecdf7 master -> master

  在windows端查看

5. 在windows当中免密使用Gitlab

1> 安装软件

  常规的windows软件安装步骤

2> 创建目录test,进入后右键,点击bash进入代码

3> 生成秘钥

  打开该秘钥文件,获得地址

4> 添加秘钥

  获取ssh地址

5> clone

6> 进入文件,创建v4版本

WenKe@Ajunyu MINGW32 ~/Desktop/test/Github_test (master)
$ git add .
WenKe@Ajunyu MINGW32 ~/Desktop/test/Github_test (master)
$ git commit -m v4
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <WenKe@Ajunyu.(none)>) not allowed
WenKe@Ajunyu MINGW32 ~/Desktop/test/Github_test (master)
$ git config --global user.email "you@example.com"
WenKe@Ajunyu MINGW32 ~/Desktop/test/Github_test (master)
$ git config --global user.name "Your Name"
WenKe@Ajunyu MINGW32 ~/Desktop/test/Github_test (master)
$ git commit -m v4
[master 753aedf] v4
file changed, insertions(+), deletions(-)
create mode "\346\226\260\345\273\272\346\226\207\346\234\254\346\226\207\346\241\243"
$ git push origin master
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To git@192.168.16.4:root/Github_test.git
46ecdf7..753aedf master -> master

7> 浏览器端查看

8> 右键后点击GUI进入图形化界面

  加入版本号进行提交

  写入地址,进行push

  关闭GUI图形化界面

  浏览器端查看

Gitlab仓库搭建及在Linux/windows中的免密使用的更多相关文章

  1. Gitlab仓库搭建及在linux/windows中免密使用gitlab(二)--技术流ken

    Gitlab简介 GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务. 可通过Web界面进行访问公开的或者私人项目.它拥有与Github类似的 ...

  2. linux系统中SSH免密设置报错

    执行 ssh-add ~/.ssh/msi_rsa 时报下面错误 Could not open a connection to your authentication agent. 解决办法: 执行命 ...

  3. Windows到Ubuntu免密登陆

    Windows到Ubuntu免密登陆 首先检查C盘用户文件夹下是否有.ssh文件夹,同时检查该文件夹中是否有至少两个文件,一个是xxx_rsa和xxx_rsa.pub,一个是私钥文件一个是公钥文件. ...

  4. 多台linux主机之间建立免密通信

    多台linux主机之间设置免密通信 例:A 向 B设置免密通信 第一步 A生成密钥对 ssh-keygen -t rsa -t 指定秘钥的类型 rsa 秘钥类型 密钥目录:/root/.ssh/(如果 ...

  5. Linux OS 集群 免密登录

    1. ssh-keygen  生成密钥 2. ssh-copy-id  集群主机名 参考: [图文详解]linux下配置远程免密登录

  6. windows配置ssh免密登录linux

    客户端(windows)要做的事情 默认机器上已安装git,若没有,请先安装git 查看本地是否有ssh公钥文件夹,若没有,则创建文件夹 mkdir ~/.ssh //创建文件夹 生成公钥 邮箱最好为 ...

  7. Windows和Linux下实现ssh免密登录

    ------------恢复内容开始------------ SSH是一种通讯协议,可以实现远程安全登录.可以通过如putty.MobaXterm等工具通过ssh安全登录到虚拟机进行操作. Opens ...

  8. 【图文详解】linux下配置远程免密登录

    linux下各种集群搭建往往需要配置远程免密登录,本文主要描述了CentOs6.3系统下配置免密登录的详细过程. ssh远程登录,两种身份验证: 用户名+密码 密钥验证 机器1生成密钥对并将公钥发给机 ...

  9. linux 下的ssh免密登陆设置

    一,原理 说明: A为linux服务器a B为linux服务器b 每台linux都有ssh的服务端和客户端,linux下的ssh命令就是一个客户端 我们常用ssh协议来进行登陆或者是文件的拷贝,都需要 ...

随机推荐

  1. 茅台【思维/数学/剪枝】By cellur925

    题目传送门 给你\(n\)根木棍,问有多少种方法,使得选出的三根木棍能组成三角形. 开始想要用搜索的,但是写着写着卡壳了(?),于是改用贪心,开始对拍,觉得很稳,只是最后两个数据可能有点卡.很第一题难 ...

  2. nacos启动

    nacos下载 https://github.com/alibaba/nacos 1.执行数据库脚本 2.修改配置文件application.propertiesspring.datasource.p ...

  3. 洛谷 P1053 篝火晚会

    https://www.luogu.org/problemnew/show/P1053 错误记录:判-1的时候出了些问题(比如只判了图是否连通):数组没清空 #include<cstdio> ...

  4. NUP2201MR

    NUP2201MR:双总线保护IC(瞬态抑制二极管),常用于USB总线的保护.

  5. 打包google浏览器插件到本地

    依次打开‘更多工具’--->'扩展程序',或者在google浏览器输入chrome://extensions/网址就可以打开已安装插件页面,在顶部选中‘开发者模式’后就会出现每个插件的ID,这个 ...

  6. Spring Cloud Gateway VS Zuul 比较,怎么选择?

    Spring Cloud Gateway 是 Spring Cloud Finchley 版推出来的新组件,用来代替服务网关:Zuul. 那 Spring Cloud Gateway 和 Zuul 都 ...

  7. CF1066E Binary Numbers AND Sum

    思路: 模拟.实现: #include <iostream> using namespace std; ; ], b[]; ]; int main() { int n, m; while ...

  8. Random-数组

    1.能够使用Random生成随机数     1)import java.util.Random;         2)Random r = new Random();       3)r.nextIn ...

  9. 更改shell

    chsh -s /usr/local/bin/bash  #更改自己的shell为bash

  10. LR11安装和配置教程

    LoadRunner11安装教程 #安装包文件.汉化文件.破解文件,可以自行百科来获得,这边仅提供安装步骤. 1.前期准备1)安装前需要关闭防火墙及杀毒软件2)安装路径不能包含中文字符,同时需要以管理 ...