git能commit无法push

git提交代码到服务器时,提示! [remote rejected] HEAD -> refs/publish/datong (n/a (unpacker error)),然后提交失败。

目前就我所知,有两种原因,一种是服务器空间不足,一种是一次性上传单文件过大。

查看git服务器剩余空间,命令:df -hl,如果空间100%,删除部分即可。

文件过大:http.postBuffer上限默认为1mb,修改上限为500mb,git config --global http.postBuffer 524288000。

如果还是解决不了,请将现有版本本地备份,回退版本,然后清除本地commit,然后pull,然后commit,最后push。

参考命令如下:

    查看空间:df -hl

    查看commit历史:git log

    回退版本(只影响本地git仓库):git reset --soft commit_id  

    回退版本(影响本地git仓库、本地代码):git reset --hard commit_id 

    删除本地所有未提交的更改:git clean -df

扫描二维码关注公众号,回复: 2971765 查看本文章

   

猜你喜欢

转载自blog.csdn.net/qq_1365462762/article/details/80623850