docker搭建gitlab服务端

本文档详细介绍了如何在Linux环境下使用Docker搭建GitLab服务端,包括安装Git、配置个人信息、创建工作区、初始化版本库,以及通过Docker安装和配置GitLab服务器,最后演示了用户授权和代码上传的步骤。
摘要由CSDN通过智能技术生成

Git:分布式版本控制工具

Git:分布式版本控制工具

  1. 安装

# yum install -y git

  1. 提交代码需要配置[root@node1个人信息

[root@room8pc16 python]# git config --global user.name "zhangzhg"

[root@room8pc16 python]# git config --global user.email "zhangzg@tedu.cn"

3、设置编写代码说明的编辑器是vim

[root@room8pc16 python]# git config --global core.editor vim

  1. 查看

[root@room8pc16 python]# git config --list

[root@room8pc16 python]# cat ~/.gitconfig

  1. 创建工作区

[root@room8pc16 ~]# mkdir mycode

  1. 初始化版本库

[root@room8pc16 ~]# cd mycode

[root@room8pc16 mycode]# git init .

[root@room8pc16 mycode]# ls -a

  1. 编写程序文件

[root@room8pc16 mycode]# echo 'hello world' > hi.txt

[root@room8pc16 mycode]# git status 查看状态

  1. 添加跟踪文件(所有文件)到版本库

[root@room8pc16 mycode]# git add .

[root@room8pc16 mycode]# git status

  1. 提交文件到版本库

[root@room8pc16 mycode]# git commit -m "add hi.txt"

[root@room8pc16 mycode]# git status

  1. 修改hi.txt

[root@room8pc16 mycode]# echo "new line" >> hi.txt

[root@room8pc16 mycode]# git add .

[root@room8pc16 mycode]# git commit -m "modify hi.txt"

  1. 恢复hi.txt到以前版本

[root@room8pc16 mycode]# git log

查看第一次提交的ID号,它的显示如下:

commit 48c488c8efb45b2c31afa225c0d7ad281ecb6b11

Author: MrZhangzhg <zhangzg@tedu.cn>

Date: Mon Jul 16 11:23:39 2018 +0800

 

add hi.txt

[root@room8pc16 mycode]# git checkout 48c488c8efb45b2c31afa225c0d7ad281ecb6b11

  1. 如果有误加入到版本库的文件,可以查到它,并删除

[root@room8pc16 mycode]# git ls-files 查看版本库中的文件

[root@room8pc16 mycode]# git rm hi.txt

[root@room8pc16 mycode]# git commit -m "delete hi.txt"

 

 

搭建

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值