[This is part 2/8 on GitLab Continuous Integration series]
To access our GitLab Server, open:
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:
- Direct access to the project via URL:
http://gitlab.example.com/devguy/gittestproject
- 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.
- Guide:
https://docs.gitlab.com/ee/user/project/settings/import_export.html, - Notes:
https://docs.gitlab.com/ee/user/project/settings/import_export.html - If secrets are lost:
https://docs.gitlab.com/ee/raketasks/backup_restore.html#when-the-secrets-file-is-lost
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.
- To export a project:
- Go to your project’s homepage.
- Click Settings in the sidebar.
- 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.
- 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
- To import a project:
- The GitLab project import feature is the first import option when creating a new project. Click on GitLab export
- Enter your project name and URL. Then select the file you exported previously
- Click on Import project to begin importing. Your newly imported project page will appear soon.
- Adjust the visibility if necessary
Delete a Project
To delete a project as root:
- Go to the project page: URL : https://gitlab.com/{USER_NAME}/{PROJECT_NAME}/edit
- Select Settings > “General” section (you must be in the repository you want to delete to delete it)
- 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:
- Navigate to your project
- Select Settings > General > Advanced.
- In the Delete project section, click the Delete project button. Confirm the action when asked to.