本地GitLab找回密码
1、首先我们登陆服务器,使用su - git 切换到git用户下操作
2、登陆后可以通过ls查看gitlab的文件,我们直接使用gitlab-rails console production进入gitlab控制台,输入命令后需要等待
Loading production environment (Rails x.x.x)等字样的显示,不然gitlab的查询语句不会被解析。
3、输入user = User.where(id:1).first ,意思就是查询id为1的用户,一般情况下超级管理员用户都是1,当然也可以使用username来查询用户,在管理员账户对询到后,可以通过返回的信息中看到admin为true,username为Administrator,当然也有的是admin,我们需要确认的就是admin为ture即可。Tips,常用的还有 user = User.all 查询所有用户 ,where条件有 username email state user = User.where(id:1).first user = User.find_by(email: 'admin@local.host')等,可以根据自己需要进行选择。
4、输入user.password='密码',密码设置为你需要修改的密码,这里的user就是第三步中User.where(id:1).first ,即修改当前用户的密码,输入完成后回车后在确认一遍user.password_confirmation ='密码' 。
5、输入user.save! 保存用户信息。
6、记得使用两次exit退出GitLab控制台。
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!