GitHub推送问题集

  • fatal: The remote end hung up unexpectedly

    修改提交缓存大小为500M,或者更大的数字
    git config --global http.postBuffer 524288000
    524288000算法:
    1024x1024x500

  • 文件大小超过100MB,需要使用LFS

  • Git Large File Storage (LFS)下载

    • git lfs install
    • git lfs track [file_name](之后可以打开.gitattributes文件编辑追踪信息)
    • git add .gitattributes
    • 正常推送,具体操作请参考 向Github推送
  • error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

    git config --global http.sslVerify “false”

  • rewrite xxxx (90%)

    %是相似性指数。相似性指数是未改变的行的百分比,不相似性指数是改变的行的百分比。它是一个向下舍入的整数,后面跟着一个百分号。 100%的相似性指数值因此保留给两个相同的文件,而100%相异性意味着旧文件中的任何一行都没有将它变成新文件。

  • push失败了才下载git LFS

    只需要放弃之前添加大文件那次的commit,重新提交文件就可以了

    撤回commit和add,将版本回退:
    * git log
    * git reset --hard [version_code]
    * git lfs track [file_name]
    * git add .
    * git commit -m init
    * git push

    如果这样还不行的话,可以保存一下修改的文件,删除文件夹,重新从GitHub上clone一下仓库,按照使用LFS的方法重新push

  • 删除工作空间,撤销commit,撤销add

    –mixed
    意思是:不删除工作空间改动代码,撤销commit,并且撤销git add . 操作
    这个为默认参数,git reset --mixed HEAD^ 和 git reset HEAD^ 效果是一样的。

    –soft
    不删除工作空间改动代码,撤销commit,不撤销git add .

    –hard
    删除工作空间改动代码,撤销commit,撤销git add .
    注意完成这个操作后,就恢复到了上一次的commit状态。

  • Git push卡在写对象那一步
    在这里插入图片描述

    这有两种情况:

    1.有大文件的

    这种情况的出现多半是因为一开始没有使用LFS,大文件已经commit提交到暂存区了,参照前面push失败了才下载git LFS的方法

    2.没有大文件的

    git config --global sendpack.sideband false,然后再push

    如果还是没有解决建议保存修改的文件重新clone一下仓库,再按照步骤push

  • TaskCanceledException encountered

    git config –global credential.helper manager

  • Auto packing the repository in background for optimum performance

本地一些 “悬空对象”太多(git删除分支或者清空stash的时候,这些其实还没有真正删除,成为悬空对象,我们可以使用merge命令可以从中恢复一些文件)

git fsck --lost-found
git gc --prune=now

  • warning: adding embedded git repository: [repository]
    hint: You’ve added another git repository inside your current repository.
    hint: Clones of the outer repository will not contain the contents of
    hint: the embedded repository and will not know how to obtain it.
    hint: If you meant to add a submodule, use:
    hint:
    hint: git submodule add [repository]
    hint:
    hint: If you added this path by mistake, you can remove it from the
    hint: index with:
    hint:
    hint: git rm --cached [repository]
    hint:
    hint: See “git help submodule” for more information.

    这说明你正在把另一个git仓库加到暂存区,Git发出警告并且报错

    使用git rm --cached [repository]清除了缓存之后还是报错

    所以删除xx仓库的.git文件夹,再去add
    请注意:该操作会清楚所有的log记录,有风险谨慎操作

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值