GitLab User Administration & Projects

[This is part 2/8 on GitLab Continuous Integration series]

To access our GitLab Server, open:

http://gitlab.example.com

Use the administration credentials that were set in last post: root / password

I. Group & User Administration

1. Create a Group [Optional]

In the toolbar click ‘Admin Area’ wrench iconI. Group & User Administration
Left Panel – in ‘Overview’ Section > Click Groups
Click Create Groups button
Type ‘Group Name’ (I choose, you can select whatever you want): Developers
Change Visibility level to: Public
Click Create Group Button

2. Create a user with role ‘Maintainer’

If you don’t have the left administration menu open, click ‘Admin Area’ wrench icon
Left Panel – in ‘Overview’ section > Click Users
Click New User button
Type ‘Name’ (any name, like): Developer Guy
Type next ‘username’ (like): devguy
Type the email (we are not setting up the notification service): devguy@gitlab.example.com
Click the Create user button

As the user will not receive the email with password we will set it ourselves.
Left Panel – in ‘Overview’ section > Click Users
‘Right panel’ – click on the Edit button in the user name, in my case: Developer Guy
Type the password: Clave123
and confirm it in the next field.
Click on Save changes button

3. Associate user to group

Left Panel – in ‘Overview’ section -> Click Groups
‘Right panel’ – click Developers
At your right there is a field with the test ‘Search fr user’. Type devguy
In the selector choose Mantainer role
Click Add users to group button


Notes on passwords

1. To Modify your own password

Log in as ‘devguy’.
Left Panel > Click Password
Type the Current Password
Type & confirm the New password
Click Save password

2. To reset a User Password

We will open a Ruby console and then:
Search for the user ID using its email. With that answer set the new password and save:

$ sudo gitlab-rails console -e production
user = User.find_by(email: 'devguy@gitlab.example.com')
Answer => User id:2 @devguy
user.password = 'Clave123'
user.password_confirmation = 'Clave123'
user.save!

II. Projects

1. Create a Project

Log in as a user (devguy)
Four panels are shown after login, click on Create project
Type Name: gittestproject (or any name you want)
Select type: public
Click Save

Project data that could be useful in the future is:

  • A project_id. In this case: 2 (shown just below the project name)
  • To get the Personal Access Token.
    In the toolbar, open selector Projects
    Click Project-Name
    Left Panel – in ‘Settingst’ section > click Access Tokens
    Type Name
    Enable the access desired, like read_repository
    Click Create project access token
    When the page is refreshed the token will be at the top.

Notes on Projects

Backup/Restore a Project

There are extensive guides on backup and restore not just for applications but for the entire instance. The documentation is clear in what is included and what are the exceptions.

Warning: For import/export make sure the version matches on both the old and the new servers. Importing will not be possible if the import instance version differs from that of the exporter.

  1. To export a project:
    1. Go to your project’s homepage.
    2. Click Settings in the sidebar.
    3. Scroll down to find the Export project button or under the general tab, expand the Advanced section. There should be an export project button there.
    4. Come back to the project settings and download the file from there, or generate a new export. Once the file is available, the page should show the Download export button
  2. To import a project:
    1. The GitLab project import feature is the first import option when creating a new project. Click on GitLab export
    2. Enter your project name and URL. Then select the file you exported previously
    3. Click on Import project to begin importing. Your newly imported project page will appear soon.
    4. Adjust the visibility if necessary

Delete a Project

To delete a project as root:

  1. Go to the project page: URL : https://gitlab.com/{USER_NAME}/{PROJECT_NAME}/edit
  2. Select Settings > “General” section (you must be in the repository you want to delete to delete it)
  3. If you have enough rights, expand the Advanced section there will be a Remove project button. Push it and follow the instructions.

To delete a project as a user:

  1. Navigate to your project
  2. Select Settings > General > Advanced.
  3. In the Delete project section, click the Delete project button. Confirm the action when asked to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s