侧边栏壁纸
博主头像
梦荟楼的后花园 博主等级

干啥啥不行干饭第一名

  • 累计撰写 59 篇文章
  • 累计创建 130 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

git 提供代码管理

梦荟楼
2024-01-08 / 0 评论 / 0 点赞 / 1 阅读 / 0 字
温馨提示:
本文最后更新于2024-01-08,若内容或图片失效,请留言反馈。 部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

git 提供代码管理

jenkins 实现持续集成,持续发布

docker&&k8s 发布

查看整篇文章请查看https://note.youdao.com/s/NuoA5Yus


Git、Github、Gitlab的区别

Git是一个开源的分布式版本控制系统、用于敏捷高效的处理任何大或小的项目是林纳斯为了帮助linux内核开发而开发的一个版本控制器

Github是在先基于Git的代码托管服务。Github提供付费账户和免费账户,这两种账户都可以创建公开的代码库,但是只有付费账户才可以创建私有代码仓库,GitLat解决了这个问题

部署Git服务

准备两台虚拟机 192.168.200.30 master 192.168.200.40 slave

初始化--两台

systemctl stop firewalld;systemctl disable firewalld;setenforce 0;iptables -F;iptables -X;iptables -Z;

下载git--两台

[root@git-master \~]# yum install -y git git-core gitweb

git-master

[root@git-master \~]# useradd git ##创建git用户
[root@git-master \~]# passwd git  ##创建git密码
Changing password for user git.New password:BAD PASSWORD: The password is a palindromeRetype new password:passwd: all authentication tokens updated successfully.
[root@git-master \~]# mkdir /git-root/ ##创建git目录 --可以不创建
[root@git-master \~]# cd /git-root/
[root@git-master git-root]# ls
[root@git-master git-root]# git init --bare tanc.git  ##创建git库git ini和git init -bare的区别在于一个是非裸库应该是非裸库裸库和非裸库区别是,非裸库可以当作git服务器使用,裸库不能进行git操作
[root@git-master git-root]# lstanc.git
[root@git-master git-root]# cd tanc.git/
[root@git-master tanc.git]# lsbranches  config  description  HEAD  hooks  info  objects  refs
[root@git-master tanc.git]# cd ..
[root@git-master git-root]# chown -R git:git tanc.git/ ##修改权限

git-slave

[root@git-slave \~]# ssh-keygen[root@git-slave \~]# ssh-copy-id git@192.168.200.30
[root@git-slave \~]# git config --global user.email "tanc@qq.com"    ##设置你的邮箱  
[root@git-slave \~]# git config --global user.name "tanc"  ##设置你的名字
[root@git-slave \~]# git clone git@192.168.200.30:/git-root/tanc.gitCloning into 'tanc'...warning: You appear to have cloned an empty repository.
[root@git-slave \~]# lstancdone[root@git-slave tanc]# cd tanc/
[root@git-slave tanc]# vim test.sh
[root@git-slave tanc]# cat test.sh
for i in 1 2 3 4
do   
    echo \$i
done
[root@git-slave tanc]# git add test.sh ##将代码文件放到暂存区
[root@git-slave tanc]# git commit -m 'tanc test'    ##提交暂存区的代码

[master (root-commit) 67a5058] tanc test1 file changed, 4 insertions(+)create mode 100644 test.sh\\-m 描述
[root@git-slave tanc]# git push origin master ##上传到仓库
Counting objects: 3, done.Writing objects: 100% (3/3), 229 bytes | 0 bytes/s, done.Total 3 (delta 0), reused 0 (delta 0)To git@192.168.200.30:/git-root/tanc.git\* [new branch]      master -> master将本地的master分支推送到origin主机的master分支。如果后者不存在,则会被新建。##把之前克隆的库删除在克隆
[root@git-slave \~]# git clone git@192.168.200.30:/git-root/tanc.git
Cloning into 'tanc'...remote: Counting objects: 3, done.remote: Total 3 (delta 0), reused 0 (delta 0)Receiving objects: 100% (3/3), done.
[root@git-slave \~]# ls
[root@git-slave \~]# cd tanc/
[root@git-slave tanc]# lstest.sh

git工作流程

image-mrkm.png

  • 一般工作流程如下:
  • 克隆 Git 资源作为工作目录。
  • 在克隆的资源上添加或修改文件。
  • 如果其他人修改了,你可以更新资源。
  • 在提交前查看修改。
  • 提交修改。
  • 在修改完成后,如果发现错误,可以撤回提交并再次修改并提交。

Git基本概念

- 工作区:就是你在电脑里能看到的目录。

- 暂存区:英文叫stage, 或index。一般存放在"git目录"下的index文件(.git/index)中,所以我们把暂存区有时也叫作索引(index)。

- 版本库:工作区有一个隐藏目录.git,这个不算工作区,而是Git的版本库。

image-ppfy.png

**-   图中左侧为工作区,右侧为版本库。在版本库中标记为 "index" 的区域是暂存区(stage, index),标记为 "master" 的是 master 分支所代表的目录树。 **

**-   图中我们可以看出此时 "HEAD" 实际是指向 master 分支的一个"游标"。所以图示的命令中出现 HEAD 的地方可以用 master 来替换。 **

**-   图中的 objects 标识的区域为 Git 的对象库,实际位于 ".git/objects" 目录下,里面包含了创建的各种对象及内容。 **

**-   当对工作区修改(或新增)的文件执行 "git add" 命令时,暂存区的目录树被更新,同时工作区修改(或新增)的文件内容被写入到对象库中的一个新的对象中,而该对象的ID被记录在暂存区的文件索引中。 **

**-   当执行提交操作(git commit)时,暂存区的目录树写到版本库(对象库)中,master 分支会做相应的更新。即 master 指向的目录树就是提交时暂存区的目录树。 **

**-   当执行 "git reset HEAD" 命令时,暂存区的目录树会被重写,被 master 分支指向的目录树所替换,但是工作区不受影响。 **

**-   当执行 "git rm --cached " 命令时,会直接从暂存区删除文件,工作区则不做出改变。 **

**-   当执行 "git checkout ." 或者 "git checkout -- " 命令时,会用暂存区全部或指定的文件替换工作区的文件。这个操作很危险,会清除工作区中未添加到暂存区的改动。 **

-   当执行 "git checkout HEAD ." 或者 "git checkout HEAD " 命令时,会用 HEAD 指向的 master 分支中的全部或者部分文件替换暂存区和以及工作区中的文件。这个命令也是极具危险性的,因为不但会清除工作区中未提交的改动,也会清除暂存区中未提交的改动。


Git客户端配置和使用

Git 提供了一个叫做 git config 的工具,专门用来配置或读取相应的工作环境变量。

这些环境变量,决定了 Git 在各个环节的具体工作方式和行为。这些变量可以存放在以下三个不同的地方:

/etc/gitconfig 文件:系统中对所有用户都普遍适用的配置。若使用 `git config` 时用--system`选项,读写的就是这个文件。

** ~/.gitconfig 文件:用户目录下的配置文件只适用于该用户。若使用 `git config` 时用 --global 选项,读写的就是这个文件。**

当前项目的 Git 目录中的配置文件(也就是工作目录中的** .git/config`文件):这里的配置仅仅针对当前项目有效。每一个级别的配置都会覆盖上层的相同配置,所以 .git/config 里的配置会覆盖 /etc/gitconfig 中的同名变量。**

git用户信息

git config --global user.name "xxx"

git config --global user.email xxxx

文本编辑器

git config --global core.editor vim

差异分析工具

git config --global merge.tool diff

查看已有的配置信息

git config --list

##如果又重复的变量名说明它们来自不同的配置文件

查看特点的变量

git config 变量

git使用

ssh 链接

客户机上产生公钥上传到gitlab的SSH-Keys里,git clone下载和git push上传都没问题,这种方式很安全

本地项目与远程服务器项目之间的交互、

假如你没有最新的代码,希望从头开始


[root@qfedu.com \~]# git clone git@XXX.git      # 这里是项目的地址(可从项目主页复制),将远程服务器的内容完全复制过来

[root@qfedu.com \~]# cd BGBInspector\_V01        # clone 之后进入该项目的文件夹

[root@qfedu.com \~]# touch README.md           # 新建readme文件

[root@qfedu.com \~]# git add README.md          # 将新的文件添加到git的暂存区

[root@qfedu.com \~]# git commit -m ‘Its note:add a readme file’ # 将暂存区的文件提交到某一个版本保存下来,并加上注释

[root@qfedu.com \~]# git push -u origin master  # 将本地的更改提交到远程服务器

如果你有一个新版代码、希望直接把他本地的代码替换到远程服务器


[root@qfedu.com \~]# cd existing\_folder          #进入代码存在的文件夹,或者直接在该文件夹打开

[root@qfedu.com \~]# git init           # 初始化

[root@qfedu.com \~]# git remote add origin git@master:/git-test/shell.git  #添加远程项目"shell"库的地址(可从项目主页复制) ,前提是事先需要先在git远程服务器上创建相应的裸库"shell"

[root@qfedu.com \~]# git add .                   #添加该文件夹中所有的文件到git的暂存区

[root@qfedu.com \~]# git commit -m ‘note’        #提交所有代码到本机的版本库

[root@qfedu.com \~]# git push -u origin master   #将本地的更改提交到远程服务器

git 中 clone过来的时候,git 不会对比本地和服务器的文件,也就不会有冲突,

建议确定完全覆盖本地的时候用 clone,不确定会不会有冲突的时候用 git pull,将远程服务器的代码download下来

git pull=git fetch+git merge

实验

##远程仓库


[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "1234"

##本地代码

[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "56789"

##使用add和commit

[root@slave tanc]# git add test1.sh

[root@slave tanc]# git command -m "test2"

git: 'command' is not a git command. See 'git --help'.

[root@slave tanc]# git commit -m "test2"

[master 1c14e0c] test2

1 file changed, 1 insertion(+), 1 deletion(-)

##使用fetch下载远程代码

[root@slave tanc]# git fetch origin master:test

From 192.168.200.30:/git-root/tanc

\* [new branch]      master     -> test

##查看本地代码有没有变化

[root@slave tanc]# ls

test1.sh

[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "56789"

##fetch是把远程代码作为本地的一个其他分支下载到本地,并不更新本地分支,这里的命令是

##把远程的"master"分支下载到本地作为一个新的分支”test“存在

##查看本地文件

##发现没有变化,用git diff 来对比两分支啥区别

[root@slave tanc]# git diff master test

diff --git a/test1.sh b/test1.sh

index 8bba5df..d47faec 100644

--- a/test1.sh

+++ b/test1.sh

@@ -1,2 +1,2 @@

#!/bin/bash

-echo "56789"

+echo "1234"

###如果fetch下来的代码没什么问题,可以选择和本地进行合并

[root@slave tanc]# git merge master

Already up-to-date.

常用git命

image-damd.png

git init ##初始化


git add [xxxx]  ##将某一个文件加入到暂存区

git add .   ##将文件夹下的所有文件加入到暂存区

git commit -m 'xxx'  ##将暂存区中的文件保存成为某一个版本

git log  #查看所有的版本日志

git status         # 查看现在暂存区的状况

git diff           # 查看现在文件与上一个提交-commit版本的区别

git reset --hard HEAD^   # 回到上一个版本

git reset --hard XXXXX   # XXX为版本编号,回到某一个版本

git pull origin master  # 从主分支pull到本地

git push -u origin master  # 从本地push到主分支

git pull                   # pull默认主分支

git push                   # push默认主分支 ...

git reflog               #查看历史命令

版本回退

##查看本地文件

[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "1234"

##使用git log查看commit版本id

##然后在使用git reset回退

[root@slave tanc]# git log

commit 1c14e0cb37bc83daeec124ac25c05776fed656c3

Author: tanc <tanc@qq.com>

Date:   Wed Sep 22 21:26:56 2021 -0400

test2

commit 68deba800df4290e0a8c8f6b4ecffaba47400136

Author: tanc <tanc@qq.com>

Date:   Wed Sep 22 21:02:52 2021 -0400

test1

##我们现在版本是test1我们退到test2

[root@slave tanc]# git reset --hard 1c14e0cb37bc83daeec124ac25c05776fed656c3

HEAD is now at 1c14e0c test2

[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "56789"

##还可以退到test1

[root@slave tanc]# git reset --hard 68deba800df4290e0a8c8f6b4ecffaba47400136

HEAD is now at 68deba8 test1

[root@slave tanc]# cat test1.sh

#!/bin/bash

echo "1234"

分支管理


[root@slave tanc]# git checkout  test ##切换到test分支 如果是有个-b

##就是创建和切换相当于 git branch dev git checkout test

[root@slave tanc]# git branch ##列出所所有分支前面有*号的表示在当前分区

master

\* test

##在test分支提交文件

[root@slave tanc]# touch txt.txt

[root@slave tanc]# git add txt.txt

[root@slave tanc]# git commit -m 'test txt'

[test 1517cc8] test txt

1 file changed, 0 insertions(+), 0 deletions(-)

create mode 100644 txt.txt

##切换master分支

[root@slave tanc]# ls

test1.sh  txt.txt

[root@slave tanc]# git checkout master

Switched to branch 'master'

[root@slave tanc]# ls

test1.sh

[root@sla

##会发现txt.txt文件不见了,应为是在test分支提交的而不是在master分支

#合并分支

[root@slave tanc]# git merge test  ##把test分支合并到master分支

Updating 68deba8..1517cc8

Fast-forward

txt.txt | 0

1 file changed, 0 insertions(+), 0 deletions(-)

create mode 100644 txt.txt

[root@slave tanc]# ls

test1.sh  txt.txt

###注意到上面的Fast-forward信息,Git告诉我们,这次合并是“快进模式”,也就是直接把master指向dev的当前提交,所以合并速度非常快。

###当然,也不是每次合并都能Fast-forward,我们后面会讲其他方式的合并

#删除test分支

[root@slave tanc]# git branch -d test

##查看所有分支

[root@slave tanc]# git branch

\* master

解决冲突


[root@slave tanc]# git checkout -b test2  ##创建test2分支并切换到它

Switched to a new branch 'test2'

##在test2创建readn.txt文件并上传

[root@slave tanc]# vim readne.txt

[root@slave tanc]# cat readne.txt

this is test2

[root@slave tanc]# git add readne.txt

[root@slave tanc]# git commit -m 'test2-readn'

[test2 d8dcea2] test2-readn

1 file changed, 1 insertion(+)

create mode 100644 readne.txt

##切换到master

[root@slave tanc]# git checkout master

Switched to branch 'master'

Your branch is ahead of 'origin/master' by 1 commit.

(use "git push" to publish your local commits)  ##git提醒你的mater的分支要比远程的master分支要超前提1个提交

##在master也创建readne.txt文件

[root@slave tanc]# cat readne.txt

this is master

##提交

[root@slave tanc]# git add readne.txt

[root@slave tanc]# git commit -m "master-readn"

[master 477138b] master-readn

1 file changed, 1 insertion(+)

create mode 100644 readne.txt

##合并

[root@slave tanc]# git merge test2

Auto-merging readne.txt

CONFLICT (add/add): Merge conflict in readne.txt

Automatic merge failed; fix conflicts and then commit the result.

##现在,master分支和feature1分支各自都分别有新的提交

##这种情况下,Git无法执行“快速合并”,只能试图把各自的修改合并起来,但这种合并就会有冲突

##查看冲突的文件

[root@slave tanc]# git status

# On branch master

# Your branch is ahead of 'origin/master' by 2 commits.

# (use "git push" to publish your local commits)

# You have unmerged paths.

# (fix conflicts and run "git commit")

# Unmerged paths:

# (use "git add <file>..." to mark resolution)

# both added:         readne.txt

no changes added to commit (use "git add" and/or "git commit -a")

##在直接查看readne.txt文件

[root@slave tanc]# cat readne.txt

<<<<<<< HEAD

this is master

=======

this is test2

>>>>>>> test2
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>

##Git用<<<<<<<,=======,>>>>>>>标记出不同分支的内容,我们修改后保存再提交:

[root@slave tanc]# git add readne.txt

[root@slave tanc]# git commit -m 'master-readn.txt'

[master 0d55c0e] master-readn.txt

##删除test2

[root@slave tanc]# git branch -d test2

Deleted branch test2 (was d8dcea2).

Github

GitLab


部署gitlab服务

##开启邮件服务

[root@master \~]# systemctl start postfix

[root@master \~]# systemctl enable postfix

##安装gitlab依赖包

[root@master \~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python

##添加清华源

[root@master \~]# cat /etc/yum.repos.d/gitlab-ce.repo

[gitlab-ce]

name=Gitlab CE Repository

baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el\$releasever/

gpgcheck=0

enabled=1

##安装gitlab

[root@master \~]# yum install -y gitlab-ce-10.1.1

##查看gitlab版本

[root@master \~]#  head -1 /opt/gitlab/version-manifest.txt

gitlab-ce 10.1.1

##设置gitlab登录链接

[root@master \~]# vim /etc/gitlab/gitlab.rb

[root@master \~]#  grep "^external\_url" /etc/gitlab/gitlab.rb

external\_url 'http://192.168.200.30'

#初始化gitlab

##配置语言环境必须使用utf-8

[root@master \~]# echo "export LC\_ALL=en\_US.UTF-8"  >>  /etc/profile

[root@master \~]# source /etc/profile

###退出ssh重新链接

##初始

[root@master \~]# gitlab-ctl reconfigure

##启动gitlab服务

[root@master \~]# gitlab-ctl start

ok: run: alertmanager: (pid 14330) 84s

ok: run: gitaly: (pid 14222) 90s

ok: run: gitlab-exporter: (pid 14220) 90s

ok: run: gitlab-workhorse: (pid 14201) 92s

ok: run: grafana: (pid 14346) 83s

ok: run: logrotate: (pid 12946) 473s

ok: run: nginx: (pid 13504) 364s

ok: run: node-exporter: (pid 14212) 91s

ok: run: postgres-exporter: (pid 14337) 83s

ok: run: postgresql: (pid 13192) 450s

ok: run: prometheus: (pid 14237) 88s

ok: run: puma: (pid 13387) 388s

ok: run: redis: (pid 12987) 467s

ok: run: redis-exporter: (pid 14223) 90s

ok: run: sidekiq: (pid 13413) 382s

##查看80

[root@master \~]# netstat -ntpl | grep 80

tcp        0      0 0.0.0.0:80              0.0.0.0:\*               LISTEN      13504/nginx: master

一下是选用配置


如果想要以上的 https 方式正常生效使用,则需要把 letsencrypt 自动生成证书的配置打开,这样在执行重新让配置生效命令 (gitlab-ctl reconfigure) 的时候会自动给域名生成免费的证书并自动在 gitlab 自带的 nginx 中加上相关的跳转配置,都是全自动的,非常方便。

[root@qfedu.com \~]# vim /etc/gitlab/gitlab.rb

letsencrypt['enable'] = true //如果因为这行报错,改成false即可

letsencrypt['contact\_emails'] = ['276267003@qq.com']     # 添加联系人的电子邮件地址

Gitlab 添加smtp邮件功能

[git@qfedu.com \~]# vim /etc/gitlab/gitlab.rb

postfix 并非必须的;根据具体情况配置,以 SMTP 的为例配置邮件服务器来实现通知;参考配置如下:

### Email Settings

gitlab\_rails['gitlab\_email\_enabled'] = true

gitlab\_rails['gitlab\_email\_from'] = '2865260231@qq.com'

gitlab\_rails['gitlab\_email\_display\_name'] = 'gitlab'

gitlab\_rails['gitlab\_email\_reply\_to'] = '2865260231@qq.com'

gitlab\_rails['gitlab\_email\_subject\_suffix'] = '[gitlab]'

gitlab\_rails['smtp\_enable'] = true

gitlab\_rails['smtp\_address'] = "smtp.qq.com"

gitlab\_rails['smtp\_port'] = 465

gitlab\_rails['smtp\_user\_name'] = "2865260231@qq.com"

gitlab\_rails['smtp\_password'] = "pwxvuyuqcozndcie" #这是我的qq邮箱授权码

gitlab\_rails['smtp\_domain'] = "smtp.qq.com"

gitlab\_rails['smtp\_authentication'] = "login"

gitlab\_rails['smtp\_enable\_starttls\_auto'] = true

gitlab\_rails['smtp\_tls'] = true

#修改配置后需要初始化配置,先关掉服务再重新初始化

[git@qfedu.com \~]# gitlab-ctl stop

ok: down: gitaly: 0s, normally up

ok: down: gitlab-monitor: 1s, normally up

ok: down: gitlab-workhorse: 0s, normally up

ok: down: logrotate: 1s, normally up

ok: down: nginx: 0s, normally up

ok: down: node-exporter: 1s, normally up

ok: down: postgres-exporter: 0s, normally up

ok: down: postgresql: 0s, normally up

ok: down: prometheus: 0s, normally up

ok: down: redis: 0s, normally up

ok: down: redis-exporter: 1s, normally up

ok: down: sidekiq: 0s, normally up

ok: down: unicorn: 1s, normally up

[git@qfedu.com \~]# gitlab-ctl reconfigure

......

[git@qfedu.com \~]# gitlab-ctl start

ok: run: gitaly: (pid 37603) 0s

ok: run: gitlab-monitor: (pid 37613) 0s

ok: run: gitlab-workhorse: (pid 37625) 0s

ok: run: logrotate: (pid 37631) 0s

ok: run: nginx: (pid 37639) 1s

ok: run: node-exporter: (pid 37644) 0s

ok: run: postgres-exporter: (pid 37648) 1s

ok: run: postgresql: (pid 37652) 0s

ok: run: prometheus: (pid 37660) 1s

ok: run: redis: (pid 37668) 0s

ok: run: redis-exporter: (pid 37746) 0s

ok: run: sidekiq: (pid 37750) 1s

ok: run: unicorn: (pid 37757) 0s

Gitlab 发送邮件测试

[git@qfedu.com \~]# gitlab-rails console

[root@wing \~]# gitlab-rails console

---

GitLab:       12.10.1 (e658772bd63) FOSS

GitLab Shell: 12.2.0

PostgreSQL:   11.7

---

Loading production environment (Rails 6.0.2)

irb(main):003:0>

irb(main):004:0> Notify.test\_email('2865260231@qq.com', 'Message Subject', 'Message Body').deliver\_now  //输入测试命令,回车

Notify#test\_email: processed outbound mail in 5.2ms

Delivered mail 5eafceaa250a\_1d063fb777add9a08601a@wing.mail (1430.1ms)

Date: Mon, 04 May 2020 16:13:30 +0800

From: gitlab <276267003@qq.com>

Reply-To: gitlab <276267003@qq.com>

To: 276267003@qq.com

Message-ID: <5eafceaa250a\_1d063fb777add9a08601a@wing.mail>

Subject: Message Subject

Mime-Version: 1.0

Content-Type: text/html;

charset=UTF-8

Content-Transfer-Encoding: 7bit

Auto-Submitted: auto-generated

X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

<html><body><p>Message Body</p></body></html>

=> #<Mail::Message:70056859616080, Multipart: false, Headers: <Date: Mon, 04 May 2020 16:13:30 +0800>, <From: gitlab <276267003@qq.com>>, <Reply-To: gitlab <276267003@qq.com>>, <To: 276267003@qq.com>, <Message-ID: <5eafceaa250a\_1d063fb777add9a08601a@wing.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>

irb(main):005:0>

可以去qq邮箱看看收到没有

image-wwjs.png

gitlab修改密码

##修改gitlab的密码
[root@master \~]# gitlab-rails console -e productionLoading production environment (Rails 4.2.8)irb(main):001:0>



irb(main):002:0\*

irb(main):003:0\* user = User.where(id: 1).first ##管理用户id为1

=> #<User id:1 @root>

irb(main):004:0> user.password = 'youissbb' ##修改密码

=> "youissbb"

irb(main):005:0> user.save! ##保存

Enqueued ActionMailer::DeliveryJob (Job ID: d5ed2d52-f349-41f8-b0e0-32f2a8e90ac9) to Sidekiq(mailers) with arguments: "DeviseMailer", "password\_change", "deliver\_now", gid://gitlab/User/1

=> true

gitlab服务管理

gitlab-ctl start                        # 启动所有 gitlab 组件;

gitlab-ctl stop                         # 停止所有 gitlab 组件;

gitlab-ctl restart                      # 重启所有 gitlab 组件;

gitlab-ctl status                       # 查看服务状态;

gitlab-ctl reconfigure                  # 初始化服务;

vim /etc/gitlab/gitlab.rb               # 修改默认的配置文件;

gitlab-ctl tail                         # 查看日志;
0

评论区