Skip to content

Instantly share code, notes, and snippets.

@munteanulc
Forked from dnozay/README.md
Created February 8, 2021 22:14
Show Gist options
  • Save munteanulc/0b4e129a0bcff2aa0e7f83bde50f95a4 to your computer and use it in GitHub Desktop.
Save munteanulc/0b4e129a0bcff2aa0e7f83bde50f95a4 to your computer and use it in GitHub Desktop.
Collection of useful stuff for interacting with gitlab.

Reset root/admin password

Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.

# start the console
sudo gitlab-rails console

Then in the ruby interpreter:

# find the user:
# user = User.find_by(email: "[email protected]")
# user = User.find_by(username: "root")
# user = User.find_by(name: "Administrator")
# user = User.find_by(admin: true)
user = User.find_by(username: "root")

# change the password
# or use the ask function from 'highline/import'
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'

# and save
user.save

Re-enable standard login

# locate application settings
# ApplicationSetting.find_each
appsettings = ApplicationSetting.find_by(signin_enabled: false)
appsettings.signin_enabled = true
appsettings.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment