GitLab 问题笔记
GitLab 配置邮件通知
添加如下相应邮箱服务商的配置到 /etc/gitlab/gitlab.rb
, 然后运行 gitlab-ctl reconfigure
使修改生效。
ruby
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
## 如果你使用的SMTP服务是默认的 'From:gitlab@localhost'
## 你可以修改这里的 'From' 的值。
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
QQ exmail (腾讯企业邮箱)
ruby
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
Office 365
ruby
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.office365.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "secret"
gitlab_rails['smtp_domain'] = "company.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
验证
在 GitLab 服务器上,执行 gitlab-rails console
进入控制台。
sh
irb(main):003:0> Notify.test_email('[email protected]', 'Message Subject', 'Message Body').deliver_now
解决 GitLab 删除或迁移项目报 500
执行下面的脚本即可
sh
gitlab-rails dbconsole
sh
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE 88
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
UPDATE 37
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;
UPDATE 6