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. 升级log4j到log4j2报错:cannot access org.apache.http.annotation.NotThreadSafe

    问题与分析 今天把项目的log4j的依赖改成了log4j2的依赖后,发现使用Maven打包时报错如下: [ERROR] Failed to execute goal org.apache.maven. ...

  2. Centos 7.x 搭建 Zabbix3.4

    前提要安装了LAMP(官方推荐环境) LNMP也可以 一.安装.配置Zabbix3.4 1:安装zabbix_RPM包 rpm -i https://repo.zabbix.com/zabbix/3. ...

  3. SpringBoot | 查看默认版本配置

    <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot ...

  4. memcpy/memmove?快速乘?

    memcpy?memmove? //#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; ; ],b[n ...

  5. hdu 3686 Traffic Real Time Query System 点双两通分量 + LCA。这题有重边!!!

    http://acm.hdu.edu.cn/showproblem.php?pid=3686 我要把这题记录下来. 一直wa. 自己生成数据都是AC的.现在还是wa.留坑. 我感觉我现在倒下去床上就能 ...

  6. iis日志存放位置 及 查看方法

    IIS:控制面板--管理工具--internet信息服务 网站的IIS日志是在空间里面看的.要登陆到空间里面的一个IIS日志里面看.IIS日志一般都很大的.看会有点.. 一.应用程序日志.安全日志.系 ...

  7. jmeter压力测试中遇到的问题汇总

    1.线程数大于1的时候,计数器配置没有勾选reset counter选项,导致测试结果出错 正常结果: 实际结果:index大于count数量时出错,病区及床号直接显示在count的基础上开始加1了 ...

  8. 【转】HashMap,ArrayMap,SparseArray源码分析及性能对比

    HashMap,ArrayMap,SparseArray源码分析及性能对比 jjlanbupt 关注 2016.06.03 20:19* 字数 2165 阅读 7967评论 13喜欢 43 Array ...

  9. Java编程基础-变量

    1.变量的定义. 变量与常量相对应,变量是在程序运行过程中它的值允许改变的量,变量可以通过变量名访问. 2.Java中的三大变量 (1).类变量.又称为静态变量,在类中定义类的属性时,使用static ...

  10. 大数据freestyle: 共享单车轨迹数据助力城市合理规划自行车道

    编者按:近年来,异军突起的共享单车极大地解决了人们共同面临的“最后一公里”难题,然而,共享单车发展迅猛,自行车道建设却始终没有能够跟上脚步.幸运的是摩拜单车大量的轨迹数据为我们提供了一种新的思路:利用 ...