赞
踩
PM(项目主管/项目经理)在gitlab创建任务,分配给开发人员
开发人员领取任务后,在本地使用git clone拉取代码库
开发人员创建开发分支(git checkout -b dev),并进行开发
开发人员完成之后,提交到本地仓库(git commit )
开发人员在gitlab界面上申请分支合并请求(Merge request)
PM在gitlab上查看提交和代码修改情况,确认无误后,确认将开发人员的分支合并到主分支(master)
开发人员在gitlab上Mark done确认开发完成,并关闭issue。这一步在提交合并请求时可以通过描述中填写"close #1"等字样,可以直接关闭issue
创建用户zyi,helen和linda,其中zyi为admin用户
用户添加完毕后,gitlab 会给用户发一封修改密码的邮件,各用户需要登录自己的邮箱,并点击相关的链接,设置新密码。
将用户zyi添加到组中,指定为本组的 owner;
将用户linda、Hellen 添加到组中,并指定为Developer
使用 zyi用户的身份与密码登录到 gitlab 界面中,并创建项目 Project-01,建好以后,系统会提示需要SSH Key
[root@git-client ~]# useradd zyi
[root@git-client ~]# su - zyi
[zyi@git-client ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zyi/.ssh/id_rsa): Created directory ‘/home/zyi/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zyi/.ssh/id_rsa.
Your public key has been saved in /home/zyi/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:W2jnRUhrEbJNG0HWwygNg3mmJuRR425+don/Ckj2FUg zyi@git-client
The key’s randomart image is:
±–[RSA 3072]----+
| .ooE+X* |
| o.oo+Xo*+ |
| o …+o.B … |
| o.o o o |
| o= S + . |
| = + B o |
| o B + |
| o + |
| oo. |
±—[SHA256]-----+
[zyi@git-client ~]$ ll -a
total 12
drwx------. 5 zyi zyi 104 Jul 15 01:38 .
drwxr-xr-x. 5 root root 43 Jul 15 01:36 …
-rw-r–r--. 1 zyi zyi 18 Jan 12 2021 .bash_logout
-rw-r–r--. 1 zyi zyi 141 Jan 12 2021 .bash_profile
-rw-r–r--. 1 zyi zyi 376 Jan 12 2021 .bashrc
drwx------. 2 zyi zyi 6 Jul 15 01:36 .cache
drwxr-xr-x. 4 zyi zyi 39 Jul 13 02:34 .mozilla
drwx------. 2 zyi zyi 38 Jul 15 01:38 .ssh
[zyi@git-client ~]$ cat ./.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDBn2QHCmq3VpBpTz15DZ8HuE1rNuGqphAYhssjItVc0hTQQ/IY9tZ+I7VSgIaCVLqPs6mMX5Q4Ix+QdRWtJ8XxSeGA6wiPkTVmqCpmqfef+NGQxvDQ81vMYPvbDQ+s1GxTUZzMFA2zvoD4AKLlfKiBAGQglsXjgG5D0I4iCMNv51kWxYEFpu+WYAHuxPn1ZNFygXbMDQP9aTlAfZgUnCBv19VoU5wpX0oIAzaSSRQzYZw6tvyQ/7Y2g4T125qvmWsLnXaHFibK0eiACWOXbV8R44nu3694bnsNFyn3J4kW2i0QK1gpt6j4dvN6eRRfi3kYcCg36/0Dl3UIhtqYB1TrQHJIUALNfwLdWVsUssk1Njz2XSxBHo10sFb5CnE49JYGjoZpF1h58oGiWsF4nigF7i0I6PsAm0Hc52MYAOaiQxYMsvu/cbH5Ux4K9QYFqB7YIUDMMcD3ykQ663SvZdbRhWXvOIT6iQx34b/MtdjNBzi1hSZf972thu+OJLmEASs= zyi@git-client
gitlab上添加以上Key
首先要上传一个文件,否则界面出不来
点击Project-01下的Branch
点击右上角New branch,便可以添加Branch了
添加成功之后,界面:
在dev分支上传lic.txt
创建合并请求
zyi用户可以Approve
可以看到dev分支已经合并了
[zyi@git-client ~]$ git config --global user.email “zyi@etaon.top”
[zyi@git-client ~]$ git config --global user.name “zyi”
[zyi@git-client ~]$ git clone git@git-server.corp.tanzu:zyi/project-01.git
Cloning into ‘project-01’…
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 1), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (7/7), done.
Resolving deltas: 100% (1/1), done.
[zyi@git-client ~]$ cd
.cache/ .mozilla/ project-01/ .ssh/
[zyi@git-client ~]$ cd project-01/
[zyi@git-client project-01]$ ll
total 12
-rw-rw-r–. 1 zyi zyi 294 Jul 15 05:33 lic.txt
-rw-rw-r–. 1 zyi zyi 5155 Jul 15 05:33 README.txt
[zyi@git-client project-01]$ vim test.sh
[zyi@git-client project-01]$ cat test.sh
#!/bin/bash
echo “gitlab test”
[zyi@git-client project-01]$ git add .
[zyi@git-client project-01]$ git commit -m 'cd028dcc2845e378c4db50ab58619f7cf8e8a70f’
On branch main
Your branch is ahead of ‘origin/main’ by 1 commit.
(use “git push” to publish your local commits)
nothing to commit, working tree clean
[zyi@git-client project-01]$ git push -u origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 325 bytes | 325.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To git-server.corp.tanzu:zyi/project-01.git
cd028dc…aa8a774 main -> main
Branch ‘main’ set up to track remote branch ‘main’ from ‘origin’.
在UI上面查看:
注意:Developer角色默认并没有提交main的权限
在客户端,切换helen用户并生成Key
[root@git-client ~]# su - helen
[helen@git-client ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/helen/.ssh/id_rsa): Created directory ‘/home/helen/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/helen/.ssh/id_rsa.
Your public key has been saved in /home/helen/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:TUqxIl5rZPel9par2bnc+OzJ4PQS/zCR+/9Jhx6olpY helen@git-client
The key’s randomart image is:
±–[RSA 3072]----+
| . |
| o |
| . = + . . |
| . = = = o . |
| . o S = o |
| . . …o + |
| oBo*…|
| EO.@o*o|
| o+.O=XoB|
±—[SHA256]-----+
[helen@git-client ~]$
[helen@git-client ~]$ ls
[helen@git-client ~]$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZY1RwMK3Smx4kCKbz4rBhu70t1ZdRR8LgcyQoczybSmZszLPCM7Ic03QK+ZdEBl59NbXWSvjiTbZCEeKzxThwqjr/HTBtF9SR6Govcocmnpt3vQfXn0oiceSlZ4IjRIvmEm6wzpeXODOdFd6W47WdR/N/IAd7Jq8HoOYHCF0M9GvutSA600LzVIQjx2iaJVGDcC5EnDaP5Ql5J7xpsZZqJeN0tLEurJfpresj0ijFuS4fX26ePci3G2TJ5lu3WnyE2qpm88GBulaK59YWco6JX6hij49YMxghN7VnLKRSMbi6PAai5rNpWLwh0GBQWJVKNzvnieqEoJ7GC6Errufdk3PGHyI2InAb65nIRV8pRavQ75ptTab8VB6d4SUfOX3VRQdOpWfIaYR7fBl9JAmI6/tfVUZshiItXL1MMRS1luZJmufnd5owRG8Ce3ezkPvbyDRXz8UyT0qAJhahGPbf1GOwy91Yt43GYGy3sKLfiZnfC/fkBYJPdLKRpoiUmkE= helen@git-client
配置参数
[helen@git-client ~]$ git config --global user.email "helen@etaon.top"
[helen@git-client ~]$ git config --global user.name "helen"
Clone并切换到dev分支
[helen@git-client ~]$ git clone git@git-server.corp.tanzu:zyi/project-01.git
Cloning into ‘project-01’…
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 10 (delta 2), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (10/10), done.
Resolving deltas: 100% (2/2), done.
[helen@git-client ~]$ cd project-01/
[helen@git-client project-01]$ git checkout dev
Branch ‘dev’ set up to track remote branch ‘dev’ from ‘origin’.
Switched to a new branch ‘dev’
新建文件并提交
[helen@git-client project-01]$ vim helen.sh
[helen@git-client project-01]$ cat helen.sh
#!/bin/bash
echo “brahch test”
[helen@git-client project-01]$ git add .
[helen@git-client project-01]$ git commit -m "20210715"
[dev 5afa05c] 20210715
1 file changed, 3 insertions(+)
create mode 100644 helen.sh
[helen@git-client project-01]$ git push -u origin dev
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 354 bytes | 354.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for dev, visit:
remote: http://git-server.corp.tanzu/zyi/project-01/-/merge_requests/new?merge_request%5Bsource_branch%5D=dev
remote:
To git-server.corp.tanzu:zyi/project-01.git
aa8a774…5afa05c dev -> dev
Branch ‘dev’ set up to track remote branch ‘dev’ from ‘origin’.
在UI页面以helen登录,提出合并请求;zyi合并
以上。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。