【问题解决】remote: parse error: Invalid numeric literal at line 1, column 20,解决思路

问题现象

某同事出现过同样的推送到git仓库报错的问题,报错信息详情如下:

bash 复制代码
Delta compresion using up to 20 threads
Compressing objects: 100%(4/4), done.
Writing objects: 100%(5/5), 521 bytes | 521.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: parse error: Invalid numeric literal at line 1, column 20
To http://域名/gitlab/仓库.git
![remote reiected] dev -> dev (pre-receive hook declined)
error: failed to push some refs to http://域名/gitlab/仓库.git

重点关注到 remote: parse error: Invalid numeric literal at line 1, column 20 查询解决方案发现大部分都在说git的推送命令后置脚本之类的问题,

排查过两次均未发现问题,重新clone并初始化用户配置后一切正常,问题出现在该同事自行clone后再作提交才会出现问题。

排查结果

这个问题常见于 git config 命令配置用户信息,如用户名、邮箱等写入错误的字符,如本例中该同事配置邮箱时将邮箱前后均加了中文双引号导致问题。

排查思路

从git config 入手,检查用户名与邮箱设置是否有中文字符等异常:

bash 复制代码
git config user.name
git config user.email

如果有异常,重新设置即可。

bash 复制代码
git config user.name xxxx
git config user.email xxxx@abc.com

PS: 问题排查是负责gitlab的同事修改后台配置返回错误信息才查到的,这里仅提供个解决思路一般遇到该问题基本可解决。

相关推荐
加油,旭杏4 小时前
【中间件学习】Git的命令和企业级开发
git
李林楠15 小时前
Git分布式版本控制工具
分布式·git
原机小子1 天前
MATLAB与Git集成:实现高效版本控制的实践指南
开发语言·git·matlab
小灰兔的小白兔1 天前
【Ubuntu】git
linux·git·ubuntu
时光追逐者1 天前
2款.NET开源且免费的Git可视化管理工具
git·microsoft·c#·.net·.netcore
课堂随想1 天前
在一个克隆的仓库中设置远程仓库并同步最新的更改
git
课堂随想2 天前
【git】通过配置 `init.defaultBranch`,自定义 Git 初始化时的默认分支名称,避免使用 `master` 并消除相关的警告提示
git
qq_377572772 天前
github 远程仓库删除 本地重新上传
git
缘友一世2 天前
macos安装git并连接gitCode远程仓库
git·macos·gitcode