Updated on 2024-06-17 GMT+08:00

Using GitLab

This section describes how to use GitLab to create a project, add project members, and integrate codes.

Creating a Project

This example demonstrates that how an administrator creates a project, initializes the project, adds a development branch dev, and hides the master branch main from developers.

  1. Click in the upper left corner and choose admin to access the management center.
  2. Choose Projects and click New project.

  3. Click Create blank project.
  4. Configure parameters for the project and click Create project.
    • Project name: Enter a project name that is easy to identify, for example, Project-example.
    • Project URL: It consists of the public IP address of the cloud service and the administrator account. Select root.

    Retain the default values for other parameters.

  5. Choose Repository > Files, click > New file, add the index.html file to main, and click Commit changes.

  6. Choose Repository > Branches, click New branch, and configure the development branch dev.
    • Branch name: dev
    • Create from: main

  7. Click Create branch. Then you can view the created development branch dev.

Adding Project Members

After registering an account, users cannot directly log in to GitLab. To let them log in, the administrator needs to approve their registration, invite them to be members of the project, and assign permissions to them.

  1. Register an account.
    1. Visit http://public IP address of the server or http://domain name.
    2. Click Register now, enter registration information, and click Register.

  2. The administrator approves the registration.
    1. Click in the upper left corner and select admin.
    2. On the Users page, select Pending approval, and click Approve.

  3. The administrator invites users to join the project team and assigns permissions to them.
    1. Click in the upper left corner, choose Projects > View all projects, and click Administrator/Project-example.
    2. Choose Project information > Members and click Invite members.
    3. Enter the username or email address, assign Developer permission to users, and click Invite.

      You can assign users the following five roles: Guest, Reporter, Developer, Maintainer, or Owner.

      • Guest: allows users to create issues and post comments, and denies them to read or write the repository.
      • Reporter: allows users to clone codes, and denies them to submit code.
      • Developer: allows users to clone, develop, submit, and push code.
      • Master: allows users to create projects, add tags, protect branches, add new members to the project, and edit projects.
      • Owner: allows users to assign permissions to access projects, delete or migrate projects, and manage project team members.
  4. Visit http://Public IP address of the server or http://Domain name. Enter the username and password to log in to GitLab.

    When members log in to GitLab for the first time, select a role for better experience.

Integrating Codes

  1. The developers edit and submit code.
    1. Visit http://Public IP address of the server or http://Domain name to log in to GitLab.
    2. Choose Projects and click the target project name.

    3. Choose Repository > Branch and click dev.

    4. Click Web IED, select a file to edit. For example, edit the index.html file.

    5. Choose on the left navigation pane to go to the SOURCE CONTROL, and click Commit & Push.

      Click No when Commit to a new branch? is displayed.

    6. Choose Repository > Files on the project menu bar. You can view Update file index.html. Click Create merge request

    7. Set request information and click Create merge request.

      Specify the Reviewer to Administrator and retain the default values for other parameters.

  2. The administrator reviews the merge request.
    1. Click in the upper right corner, choose Merge requests > New merge request, and click the specific request title.

    2. Click Merge to merge the index.html file from dev into main.