GitLab使用常见问题

GitLab重置用户密码

进入rails命令行

[root@centos7-aliyun-sz ~]# gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
 GitLab:       13.12.3 (757327a59bc) FOSS
 GitLab Shell: 13.18.0
 PostgreSQL:   12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.6)

通过用户名查找管理员账号

irb(main):001:0> 
irb(main):002:0> user = User.where(username:root).first
Traceback (most recent call last):
        1: from (irb):1
NameError (undefined local variable or method `root' for main:Object)
irb(main):003:0> user = User.where(username:'root').first
=> #<User id:1 @root>
irb(main):009:0> user.password = '12345678'
=> "12345678"
irb(main):010:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):011:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 44578801-4e75-4d52-8ac4-452ba8290c1b) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f4a8e5c8f20 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):012:0> 

另外除了该方式找回还可以id=1定位超级管理员

u= User.where(id: 1).first 

设置密码
上一步已经将管理员用户对象给了u变量

irb(main):002:0> u.password='new_password'
=> "new_password" 
保存用户密码
irb(main):003:0> u.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 99118288-b58b-4d52-94c1-28979bcb63e8) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true

这一步save如果报错的话,检查下密码的长度,需要8位以上

退出rails终端

irb(main):004:0> quit

此时管理员账号的密码已经重新设置了,登录即可

GitLab推送大型仓库失败

报错内容

[root@xxxxxx]# git push -u origin --all
Counting objects: 798155, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (486395/486395), done.
Writing objects:   3% (24616/798155), 308.58 MiB | 1.34 MiB/s   
Writing objects:   3% (24616/798155), 309.96 MiB | 1.34 MiB/s   



Writing objects:  77% (619925/798155), 8.45 GiB | 1.35 MiB/s     
Writing objects:  80% (642182/798155), 10.43 GiB | 1.35 MiB/s   
Writing objects:  83% (664629/798155), 11.93 GiB | 1.36 MiB/s   
Writing objects:  83% (664629/798155), 11.93 GiB | 1.36 MiB/s   
Writing objects:  90% (725345/798155), 16.39 GiB | 1.34 MiB/s      
Writing objects:  90% (725345/798155), 16.40 GiB | 1.34 MiB/s   

Writing objects: 100% (798155/798155), 18.56 GiB | 1.36 MiB/s, done.
Total 798155 (delta 216090), reused 795280 (delta 214658)
remote: Resolving deltas: 100% (216090/216090), done.
remote: Checking connectivity: 798155, done.
remote: GitLab: Push operation timed out
remote: 
remote: Timing information for debugging purposes:
remote: Running checks for ref: master
remote: Checking if you are allowed to push... (4.0ms)
remote: Checking if default branch is being deleted... (0.11ms)
remote: Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab... (cancelled after 29022.93ms)To git@xxx:xxx/xxx-android-q-v1.9.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@xxx:xxx/xxx-android-q-v1.9.git'

解决方案
(1)在gitlab上将对应仓库的设置中关闭LFS,然后再重新推送;
(2)修改服务器的内存配置,由8G改为16G;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值