Get the App
SLTechnology News&Howtos  ›  Servers  › 

CI/CD Operation Manual in traditional Cloud Environment (4) configuring gitlab

Shulou Source: shulou.com Published: 2022-06-02 17:29:33 09月18日 Update

Version control (code management) tool

1 CVS

2 SVN centralized version control system

There is only one remote code base, and all programmers need to connect to the network to push the code to the server.

3 Gitlab distributed version control system

There is a remote code base, and every programmer can clone a local code base remotely and work offline. Of course, every programmer has limited permissions and can only clone parts of the code that have permission.

Installation configuration

Download gitlab-ce and upload it to the server

Yum-y install gitlab-ce-10.8.7-ce.0.el7.x86_64.rpm

Vim / etc/gitlab/gitlab.rb

External_url 'http://192.168.1.14' # external access address

Gitlab_rails ['smtp_enable'] = true # the purpose of configuring the mail service is to allow users who forget their passwords to reset their passwords themselves through their mailboxes

Gitlab_rails ['smtp_address'] = "smtp.163.com"

Gitlab_rails ['smtp_port'] = 25

Gitlab_rails ['smtp_user_name'] = "dongyali@163.com"

Gitlab_rails ['smtp_password'] = "aaaaaaaa"

Gitlab_rails ['smtp_authentication'] = "login"

Gitlab_rails ['smtp_enable_starttls_auto'] = true

Gitlab_rails ['smtp_tls'] = false

Gitlab_rails ['gitlab_email_from'] =' dongyali521521@163.com'

Gitlab_rails ['smtp_domain'] = "163.com"

User ['git_user_email'] = "dongyali521521@163.com"

Gitlab-ctl reconfigure

Gitlab-ctl status

Grep "^ [a Merz]" / etc/gitlab/gitlab.rb

Http://192.168.1.14

Root needs to be configured with a password when logging in for the first time

Basic operation

Disable the account registration function:

Click the wrench icon-setting---sign up restrictions--- to cancel sing-up enabled

New user:

Click the wrench icon-new user. Mailbox is required to reset the password.

Create a new group:

Click the wrench icon-new group, create the group, click Add user (s) to the group, add the user to the group and grant the appropriate permissions

Administrators belong to each group by default

There are five types of permissions for users: guest,reporter,developer,maintainer,owner

Create a new project:

Click the wrench icon-new project. The project path needs to select root or a group.

Clone the code in http (username and password required)

Yum-y install git

View the clone address on gitlab:

Project---your project---project name---http mode

Git clone http://192.168.1.14/group1/project1.git

Cd project1/

Vim index.html

Git add.

Git config-global user.name "user1"

Git config-global user.email 465130613@qq.com

Git commit-m "xxxx"

Git config-global push.default simple

Git push

Secret-free cloning code with ssh method

Generate the key of the root user on the git client

Cd / root

Ssh-keygen

Cat / root/.ssh/id_rsa.pub

Configure the pub-key generated above on gitlab:

Click the projects---your projects---projects name--- gear icon settings

-repository---Deploy Keys--- enter key value-click Write access allowed

Rm-rf project1/ # deletes the previously cloned

Git clone git@192.168.1.15:group1/project1.git (input yes for the first time to pull)

Cd project1/

Vim index.html

Git add.

Git commit-m "11111"

Git push

Tags: Code user icon password configuration wrench permissions method version program programmer control service address control system server first time system mailbox project Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Xiaomi macOS Redmi