前言

经常更新gitea
开始几次都没事, 退掉正在运行的gitea, 更换新版本, 重新运行gitea.
git客户端提交, push都正常.

今天换了 gitea-1.16.8-gogit-windows-4.0-amd64.exe.
因为时间久了, 整错地方了. 没有放到库目录下, 就开始运行.
结果发现迁出的库, 无法push了.
登录gitea本地管理网页(http://localhost:3000), 发现自己忘记密码, 甚至不确定用户名是啥. 这个有点严重…

后来发现自己将 gitea-1.16.8-gogit-windows-4.0-amd64.exe 摆错地方了, 退掉 gitea, 将 gitea-1.16.8-gogit-windows-4.0-amd64.exe摆到 本库git库目录下重新运行后, 还是无法登录管理网页(用户名和口令不对, 自己又想不起来).

这咋弄, 有点严重啊.

笔记

先去查网上资料, 如何重置gitea系统的用户名和口令, 资料比较简单, 不好使, 不知所以然. 资料上没说他们用的gitea版本, 也没说那些恢复的命令行哪里来的. 如果是这样的话, 如果用的gitea版本和他们不一样, 就不好使了.

实验环境

win10-21H2 + gitea-1.16.8-gogit-windows-4.0-amd64.exe

实验

来做个实验, 来捋出解决问题的方法. 这样, 等gitea版本升级了, 也有一个通用的解决方案.

线索

从网上资料看, gitea是有命令行的, 那试试命令行.
从gitea的github库下载的release, 只有一个exe, 我下载的是 gitea-1.16.8-gogit-windows-4.0-amd64.exe.
只要直接运行gitea-1.16.8-gogit-windows-4.0-amd64.exe, 啥都有了.
那来看看这个gitea-1.16.8-gogit-windows-4.0-amd64.exe有没有命令行.

切到自己的git库目录

C:\Users\xx>cd /d E:\git_rep_localE:\git_rep_local>

查看gitea的命令行用法提示

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe --help > help.txtE:\git_rep_local>

打开help.txt

NAME:Gitea - A painless self-hosted Git serviceUSAGE:gitea-1.16.8-gogit-windows-4.0-amd64.exe [global options] command [command options] [arguments...]VERSION:1.16.8 built with GNU Make 4.1, go1.18.2 : bindata, sqlite, sqlite_unlock_notifyDESCRIPTION:By default, gitea will start serving using the webserver with no
arguments - which can alternatively be run by running the subcommand web.COMMANDS:web              Start Gitea web serverserv             This command should only be called by SSH shellhook             Delegate commands to corresponding Git hooksdump             Dump Gitea files and databasecert             Generate self-signed certificateadmin            Command line interface to perform common administrative operationsgenerate         Command line interface for running generatorsmigrate          Migrate the databasekeys             This command queries the Gitea database to get the authorized command for a given ssh key fingerprintconvert          Convert the databasedoctor           Diagnose problemsmanager          Manage the running gitea processembedded         Extract embedded resourcesmigrate-storage  Migrate the storagedocs             Output CLI documentationdump-repo        Dump the repository from git/github/gitea/gitlabrestore-repo     Restore the repository from diskhelp, h          Shows a list of commands or help for one commandGLOBAL OPTIONS:--port value, -p value         Temporary port number to prevent conflict (default: "3000")--install-port value           Temporary port number to run the install page on to prevent conflict (default: "3000")--pid value, -P value          Custom pid file path (default: "/run/gitea.pid")--quiet, -q                    Only display Fatal logging errors until logging is set-up--verbose                      Set initial logging to TRACE level until logging is properly set-up--custom-path value, -C value  Custom path file path (default: "E:/git_rep_local/custom")--config value, -c value       Custom configuration file path (default: "E:/git_rep_local/custom/conf/app.ini")--version, -v                  print the version--work-path value, -w value    Set the gitea working path (default: "E:/git_rep_local")--help, -h                     show helpDEFAULT CONFIGURATION:CustomPath:  E:/git_rep_local/custom CustomConf:  E:/git_rep_local/custom/conf/app.iniAppPath:     E:/git_rep_local/gitea-1.16.8-gogit-windows-4.0-amd64.exeAppWorkPath: E:/git_rep_local

可以看到 admin 选项 是管理操作相关的

看看admin命令的用法

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin --help > help.txtE:\git_rep_local>

打开 help.txt

NAME:Gitea admin - Command line interface to perform common administrative operationsUSAGE:Gitea admin command [command options] [arguments...]COMMANDS:user                Modify usersrepo-sync-releases  Synchronize repository releases with tagsregenerate          Regenerate specific filesauth                Modify external auth providerssendmail            Send a message to all usersOPTIONS:--custom-path value, -C value  Custom path file path (default: "E:/git_rep_local/custom")--config value, -c value       Custom configuration file path (default: "E:/git_rep_local/custom/conf/app.ini")--version, -v                  print the version--work-path value, -w value    Set the gitea working path (default: "E:/git_rep_local")--help, -h                     show helpDEFAULT CONFIGURATION:CustomPath:  E:/git_rep_local/custom CustomConf:  E:/git_rep_local/custom/conf/app.iniAppPath:     E:/git_rep_local/gitea-1.16.8-gogit-windows-4.0-amd64.exeAppWorkPath: E:/git_rep_local

可以看到 user 选项是修改用户信息的.

查看 user的命令行帮助

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user --help > help.txtE:\git_rep_local>

打开 help.txt

NAME:Gitea admin user - Modify usersUSAGE:Gitea admin user command [command options] [arguments...]COMMANDS:create           Create a new user in databaselist             List userschange-password  Change a user's passworddelete           Delete specific user by id, name or emailOPTIONS:--custom-path value, -C value  Custom path file path (default: "E:/git_rep_local/custom")--config value, -c value       Custom configuration file path (default: "E:/git_rep_local/custom/conf/app.ini")--version, -v                  print the version--work-path value, -w value    Set the gitea working path (default: "E:/git_rep_local")--help, -h                     show helpDEFAULT CONFIGURATION:CustomPath:  E:/git_rep_local/custom CustomConf:  E:/git_rep_local/custom/conf/app.iniAppPath:     E:/git_rep_local/gitea-1.16.8-gogit-windows-4.0-amd64.exeAppWorkPath: E:/git_rep_local

可以看到, 已经到了用户操作的具体命令处了. 这里就大概知道咋干活了.
因为忘记了用户名, 先查看用户名列表. 尴尬啊…

查看gitea用户列表

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user list > help.txtE:\git_rep_local>

打开help.txt

ID   Username Email                   IsActive IsAdmin
1    me me@me.com true     true

可以看到, 我只给自己建立了一个用户, 这个用户名是me, 处于激活状态, 且是gitea管理员.
那现在就可以尝试重置me这个用户的口令, 然后用新口令登录, 就可以做所有事了.

查看如何修改用户口令

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user change-password --help > help.txtE:\git_rep_local>

打开help.txt

NAME:Gitea admin user change-password - Change a user's passwordUSAGE:Gitea admin user change-password [command options] [arguments...]OPTIONS:--username value, -u value     The user to change password for--password value, -p value     New password to set for user--custom-path value, -C value  Custom path file path (default: "E:/git_rep_local/custom")--config value, -c value       Custom configuration file path (default: "E:/git_rep_local/custom/conf/app.ini")--version, -v                  print the version--work-path value, -w value    Set the gitea working path (default: "E:/git_rep_local")DEFAULT CONFIGURATION:CustomPath:  E:/git_rep_local/custom CustomConf:  E:/git_rep_local/custom/conf/app.iniAppPath:     E:/git_rep_local/gitea-1.16.8-gogit-windows-4.0-amd64.exeAppWorkPath: E:/git_rep_local

开始修改用户口令

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user change-password -u me -p me > help.txtE:\git_rep_local>

打开help.txt

2022/05/20 09:46:53 main.go:117:main() [F] Failed to run app with [gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user change-password -u me -p me]: Password is not long enough. Needs to be at least 6

可以看到, 口令没修改成功. 原因是口令长度最少要6个字符.

尝试开始修改用户口令

E:\git_rep_local>gitea-1.16.8-gogit-windows-4.0-amd64.exe admin user change-password -u me -p me1111 > help.txtE:\git_rep_local>

打开help.txt

me's password has been successfully updated!

可以看到, me用户的口令已经修改成功了.

尝试登录本地gitea管理网页

运行本地git库目录下gitea-1.16.8-gogit-windows-4.0-amd64.exe.
在chrome浏览器中访问 http://localhost:3000
用list看到的管理员用户名登录, 输入自己改过的口令, 登录成功.

客户端尝试push

我就是发现push有问题, 才发现gitea.exe放错了位置, 进一步发现自己忘了用户名和口令.

现在重新push时, 因为用户名/口令已经重置了, 要重新输入用户名/口令, 输入改过的用户名/口令, 点击确定按钮.

看到git客户端显示push成功, gitea的命令行界面也提示操作成功.

总结

问题解决.

这篇笔记分享了通用的gitea命令行用法, gitea升级了也不怕.

gitea还是挺好用的. 作者考虑的周全.

只要能物理接触到本地git库, 计算机的所有者当然有权限修改git库权限. gitea给的修改本地库口令功能是合理的.

自己本地不重要的git本地库, 可以尝试不断升级到最新的git库工具版本.
遇到问题, 总有解决的方法. 即使解决不了, 也有变通的方法, 损失都是可以接受的.

正式的git库相关工具配置是不能随便升级的.而且要定期做git库备份, 安全第一

补充 - 2022_0901

今天手欠, 看到有新版gitea-1.17.1, 顺手就更新了.
尝试去登录 http://localhost:3000 , 忘记用户名了.
又从头看这篇笔记, 思路还是管用的, 思路没变.
尝试列出用户名列表

gitea-1.17.1-gogit-windows-4.0-amd64.exe admin user list

执行完后, 看到用户名后, 就想起自己的常用密码了.

END

gitea 1.16.8 忘记口令的处理思路相关推荐

  1. 面试技巧:16个经典面试问题回答思路

    今天有家里的小弟快要大学毕业了,问我怎么去面试的?想想自己已经有好多年没有面试的经历了.再说自己本来跳槽不多,面试经历的也不多,所以也没有敢说出什么建议来.但看到下面的篇内容,觉的不错,就推荐给小弟去 ...

  2. 瑜伽教学法 | 45天,背会16个体式口令、静作词和休息术,就能当瑜伽老师了?

    心合瑜伽学院 今天 我是2018年3月12日走进教培班的! 经过短短的一个半月的培训,我熟练的背会了16个体式的流程和口令,背会了静坐词,背会了休息术引导词,还有一套拜日的热身体式. 大家可能会笑,不 ...

  3. ubuntu 16.04忘记登录密码的解决办法

    1.开机长按shift,我这是按esc,出现如下界面,选中如下选项: 2.按回车键进入如下界面,然后选择有recovery mode的选项,注意:然后按e进入3的界面(请不要使用enter键) 推荐选 ...

  4. oracle忘记口令

    http://2024486.blog.51cto.com/339445/107575 可行: 1.在命令行下输入 set oracle_sid=database;database为任务管理器中服务的 ...

  5. 16个经典面试问题回答思路

    在一般的互联网公司的技术人员的面试中,大概会经历3到4轮的面试,差不多2-3轮的技术面,还有1轮的HR面试,今天给你总结的这些问题,都是和技术无关的,但是技术人员也可能会被问到的.这些问题没有标准答案 ...

  6. 面试必问的16个经典问题的回答思路

    面试过程中,面试官会向应聘者发问,而应聘者的回答将成为面试官考虑是否接受他的重要依据.对应聘者而言,了解这些问题背后的"猫腻"至关重要.本文对面试中经常出现的一些典型问题进行了整理 ...

  7. 16个经典面试问题回答思路[求职者必看]

    试过程中,面试官会向应聘者发问,而应聘者的回答将成为面试官考虑是否接受他的重要依据.对应聘者而言,了解这些问题背后的"猫腻"至关重要.本文对面试中经常出现的一些典型问题进行了整理, ...

  8. 面试技巧:16个经典面试问题回答思路(转)

    面试过程中,面试官会向应聘者发问,而应聘者的回答将成为面试官考虑是否接受他的重要依据.对应聘者而言,了解这些问题背后的"猫腻"至关重要.本文对面试中经常出现的一些典型问题进行了整理 ...

  9. 分享16个经典面试问题回答思路

    面试过程中,面试官会向应聘者发问,而应聘者的回答将成为面试官考虑是否接受他的重要依据.对应聘者而言,了解这些问题背后的"猫腻"至关重要.本文对面试中经常出现的一些典型问题进行了整理 ...

最新文章

  1. Mysql-cobar集群安装部署手册
  2. AAAI Fellow 2019名单公布!罗杰波、刘欢等人入选
  3. java export命令_Linux 命令详解(一)export 命令
  4. 从喧闹与富有中搞懂搜索和拓扑
  5. Android初级第一讲---Android开发环境的配置
  6. selenium自动化测试_为什么在生产中进行Selenium自动化测试对于您的下一个版本至关重要?...
  7. 高中技校学计算机,我没考上高中,英语数学极差,想上技校学计算机专业,玩代码的那种,有前途吗?...
  8. Integrity Pro for mac(网站死链接清理)
  9. 台电 8G U盘通过量产程序实现USB-CDROM启动
  10. 计算机网络是指将多台具有独立功能,计算机等级考试四级网络工程师2015年模拟试题及答案(三)...
  11. 阶段性总结 个人总结 (上)
  12. Unity XCode 拨号和一键加群
  13. 三星dex安装linux软件,三星DeX应用试玩体验 无需扩展坞就能把PC变成工作站
  14. 日本知名汽车零部件公司巡礼系列之株式会社70
  15. 进程间通信(管道、XSI--->SysV、网络套接字)
  16. html转成高清pdf,Javascript实现html转pdf高清版(提高分辨率)
  17. 区块如何防篡改_一种区块链防篡改技术的优化方法与流程
  18. tig git的好搭档
  19. Boardcast Receiver 源码分析:广播的动态注册、发送和接收过程
  20. 张艾迪(创始人):解码互联网天才

热门文章

  1. 用python写一元二次方程_使用Python解一元二次方程!
  2. 初步认识计算机网络的结构特点
  3. Red Hat Ubuntu Centos 更改登录横幅
  4. 2016蓝桥杯b组java试题及答案_2016年第七届蓝桥杯java B组省赛试题
  5. 直播实录|百度大脑EasyDL·NVIDIA专场 部署专家
  6. ESP8266 烧写选项 Flash Size 32M和32M-c1的区别
  7. 数据结构串之寻找整数
  8. Angular在洋葱圈的实践与思考
  9. ventoy集成微PE+优启通;vmware虚拟机如何进入PE系统,ventoy启动盘制作。
  10. centos7上部署php7遇到的坑