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

相关推荐
嘻嘻仙人17 小时前
Ubuntu中 git上传自己的项目和二次上传一般流程
git·github
Patrick_Wilson17 小时前
Squash Merge 的血缘陷阱:为什么删掉的代码又活了过来
前端·git·程序员
沉浸学习的匿名网友19 小时前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
深海鱼在掘金2 天前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
江华森2 天前
Git 基础筑基:从原理到团队协作的全栈实战
git
JakeJiang2 天前
Git 必备命令指南:从日常高频到项目开发实战
git
叫我少年3 天前
Windows 中安装 git
git
深海鱼在掘金8 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc9 天前
关于Git Flow
git
蜜獾云9 天前
在Git中配置用户名和密码
git