Default Branch
This first configuration is optional, I prefer to work with the default branch as master:
SMTP
I have a gmail account for my domains and I will configure it to send and receive emails from Gitlab.
There is a page with details on how to configure it for Gmail and other services:
SMTP settings | GitLab
If you have 2-step validation turned on, you will need to change some settings in your Gmail:
Less secure apps & your Google Account – Google Account Help
The configuration process is simple, in the same way as configuring integration with LDAP:
vi /etc/gitlab/gitlab.rb
Add SMTP server information, user, pass, etc. Do not change the entire file, just this part of SMTP. (gitlab.rb)
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "xxxxxxx.xxxxxxx@xxxxxxx.xxx"
gitlab_rails['smtp_password'] = "XYXYXYXYXYXYX"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
# If your SMTP server does not like the default 'From: gitlab@localhost' you
# can change the 'From' with this setting.
gitlab_rails['gitlab_email_from'] = 'xxxxxxx.xxxxxxx@xxxxxxx.xxx'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@xxxxxxx.xxx'
After that, run the command to reconfigure GitLab, this leads to some downtime and may take a while.
gitlab-ctl reconfigure
After GitLab is back active, run a check in the ruby console:
$ gitlab-rails console
Notify.test_email('your.email@yourdomain.com', 'Message Subject', 'Message Body').deliver_now
Result:
Delivered mail 660d47fb655f_65a72d006694d@srv-gitlab-02.mail (1318.9ms)
=> #<Mail::Message:382380, Multipart: false, Headers: <Date: Wed, 03 Apr 2024 12:13:47 +0000>, <From: GitLab <xxxxxxx.xxxxxxx@xxxxxxx.xxx>>, <Reply-To: GitLab <noreply@xxxxxxx.xxx>>, <To: your.email@yourdomain.com>, <Message-ID: <660d47fb655f_65a72d006694d@srv-gitlab-02.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
Leave a Reply