系统 :centos7
gitlab版本:gitlab-ce-11.6.2-ce.0.el7.x86_64
安装方式: yum install gitlab-ce-11.6.2-ce.0.el7.x86_64 -y
需求:用gitlab api python方式导入大量用户需要邮箱验证比较麻烦 ,所以,去掉新建用户的邮件验证,还能切断外网,内网使用gitlab。

[root@k8s_gitlab ~]# vim /opt/gitlab/embedded/service/gitlab-rails/app/models/user.rb
devise :lockable, :recoverable, :rememberable, :trackable,
:validatable, :omniauthable, :registerable

vim /opt/gitlab/embedded/service/gitlab-rails/app/controllers/admin/users_controller.rb
def confirm
if user.confirm!
redirect_to :back, notice: "Successfully confirmed"
else
redirect_to :back, alert: "Error occurred. User was not confirmed"
end
end

删掉!!!!

vim /opt/gitlab/embedded/service/gitlab-rails/app/views/admin/users/show.html.haml

  • unless @user.confirmed?
    .panel.panel-info
    .panel-heading
    Confirm user
    .panel-body
    • if @user.unconfirmed_email.present?
      • email = " (#{@user.unconfirmed_email})"
        %p This user has an unconfirmed email address#{email}. You may force a confirmation.
        %br
        = link_to 'Confirm user', confirm_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' }

删掉
挂掉以上三个文件

gitlab-ctl restart