Skip to content

Instantly share code, notes, and snippets.

@macdja38
Created July 26, 2018 20:14
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save macdja38/3d62d4f251bd7c46f0128bb6a9d35544 to your computer and use it in GitHub Desktop.
Save macdja38/3d62d4f251bd7c46f0128bb6a9d35544 to your computer and use it in GitHub Desktop.
Confirm gitlab email by CLI

On your gitlab server run gitlab-rails console production

Find your user via user = User.find_by(email: "youroldemail@example.com")

Optionally change the user's email with user.email = "yournewemail@example.com" Then run user.save!

Get the user's token with user.confirmation_token

https://PutYourGitlabHere/users/confirmation?confirmation_token=PutYourTokenHere

I used this to change my email on a gitlab instance without an email server.

@Schnitzel
Copy link

thank you, this saved me hours <3

@nemeth-it
Copy link

Same here. Thanks!

@nfriend
Copy link

nfriend commented Aug 24, 2020

❤️ 👍 😄

@hesstobi
Copy link

hesstobi commented Sep 1, 2020

To verify a secondary email use:

email = Email.find_by(email: "youroldemail@example.com")
email.confirm()

@gpchelkin
Copy link

gpchelkin commented Nov 2, 2020

UPD: To verify a secondary email use:

email = Email.find_by(email: "secondaryemail@example.com")
email.confirmed_at = Time.zone.now
email.save!

Works on GitLab 13.3.4
Idea from https://docs.gitlab.com/ce/user/upgrade_email_bypass.html#what-do-i-do-if-i-am-an-administrator-and-i-am-locked-out

@eli-yip
Copy link

eli-yip commented Jan 21, 2024

thank you so much!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment