【问题解决】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的同事修改后台配置返回错误信息才查到的,这里仅提供个解决思路一般遇到该问题基本可解决。

相关推荐
素雨迁喜16 分钟前
Linux平台下git工具的使用
linux·运维·git
Irene19912 小时前
Windows环境,VS Code 中 Git 配置指南
git·基础配置
Yang-Never3 小时前
AI Code -> Windows电脑安装Claude
开发语言·windows·git
Irene19913 小时前
2026 前端开发 Windows 安装 Git 配置指南(有实际安装过程参考:适配版本 the latest 2.53.0(2) x64 )
前端·windows·git
早起的年轻人4 小时前
告别Git仓库臃肿:一招解决Maven target目录误提交问题
java·git·maven
悠然大月季20 小时前
git 怎么导出提交历史,文件是乱码
git·git导出历史记录·git导出历史乱码
chenshiming8021 天前
在cursor下执行GIT回退版本
git
打点计时器1 天前
Git快速上手教程
git
我才是一卓1 天前
linux 安装简易 git 服务端并使用
linux·运维·git
IDIOT___IDIOT1 天前
关于 git 进行版本管理的时候 gitignore 写入忽略规则而不生效的问题
大数据·git·elasticsearch