• Git


    前言

    总结在使用 Git 遇到的问题 

    问题(一)

    如图所示

    Push failed Enumerating objects: 727, done. Delta compression using up to 12 threads RPC failed; curl 18 transfer closed with outstanding read data remaining the remote end hung up unexpectedly Total 727 (delta 60), reused 0 (delta 0), pack-reused 0 the remote end hung up unexpectedly

    原因分析

    git 有两种拉代码的方式,一个是 HTTP,另一个是 ssh。git 的 HTTP 底层是通过 curl 的。HTTP 底层基于 TCP,而 TCP 协议的实现是有缓冲区的。 所以这个报错大致意思就是说,连接已经关闭,但是此时有未处理完的数据;

    因为git项目或者文件太大造成的错误,而缓冲区太小,所以导致这个错误

    解决方案

    step1:查看git的配置

    git config -l

    step2:加大缓冲区大小(http.postBuffer的参数)

    增大缓冲区大小。 
    (1)切到 git 项目目录后,执行如下命令,
    
    // 524288000 的单位代表 B,524288000B 也就是 500MB。
    // 这个值的大小,可自行酌情设置。
    git config –
    -global http.postBuffer 524288000

    git config http.postBuffer 524288000
    
    然后查看是否设置成功,
    
    git config –l | grep postbuffer
     
    
    如果以上都不行,使用以下方法:
    
    配置如下:
    
    $ git config --global http.postBuffer 24288000
    
    $ git config --list

    问题(二)

    如图所示

    Push rejected 
    Push master to autoShell/master was rejected by remote

    原因分析

    这个分支受保护不允许提交,意思是我的权限太低,由于这个是master分支,所以dev权限不允许,找管理员授权吧,或者另外拉dev分支后在去合并到master

    解决方案

    git remote add origin git@github.com:emeil/autoShell.git
    // 添加远程版本库

    git branch -M main // 修改分支名 M强制修改 若与其他分支有冲突也会创建(慎用)

    git push -u origin main

    问题(三)

    error: failed to push some refs to 'github.com:email/autoShell.git'

    原因分析

    当我们在github版本库中发现一个问题后,你在github上对它进行了在线的修改;或者你直接在github上的某个库中添加readme文件或者其他什么文件,但是没有对本地库进行同步。这个时候当你再次有commit想要从本地库提交到远程的github库中时就会出现push失败的问题。

    解决方案

    这个问题是因为远程库与本地库不一致造成的,那么我们把远程库同步到本地库就可以了。

    git pull --rebase origin master

    执行以上命令

    问题(四)

    fatal: couldn't find remote ref master

    原因分析

    新建的项目,pull的时候出现这错误,说白了就是这个项目还没有文件,直接把本地修改的上传就可以了,不需要拉了

    解决方案

    (1)检查本地GIT的配置:检查本地的用户名和邮箱是否填写正确
    查看
    $ git config user.name
    $ git config user.email
    
    修改
    $ git config --global user.name "你的中文名"
    $ git config --global user.email "邮箱"

    (2)检查远程仓库配置:如果远程仓库信息有误,则删除本地仓库配置,并且设置相关地址

    查看
    $ git remote -v
    $ git remote rm origin
    $ git remote add origin XXXX // XXXX 指的是 git@github.com:emeil/autoShell.git


    (3)还是不行的话可以找到文件路径下 git文件所在,打开config文件,删除[remote “origin”] 下信息。重复1,2步骤。
     


    问题(五)

    Can't finish GitHub sharing process
    Successfully created project 'autoShellScript' on GitHub, but initial push failed: Enumerating objects: 727, done. Delta compression using up to 12 threads Total 727 (delta 61), reused 0 (delta 0), pack-reused 0 remote: warning: File kubernetes/kube-scheduler/kube-scheduler is 54.54 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB remote: warning: File kubernetes/kubectl/kubectl is 54.70 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: 1ff0549417dca974ee15fac5973ef800677da53a6376c2dec9f827be0627bcd6 remote: error: See http://git.io/iEPt8g for more information. remote: error: File kubernetes/kubelet/kubelet is 168.56 MB; this exceeds GitHub's file size limit of 100.00 MB remote: error: File kubernetes/kube-apiserver/kube-apiserver is 183.85 MB; this exceeds GitHub's file size limit of 100.00 MB remote: error: File kubernetes/kube-controller-manager/kube-controller-manager is 155.40 MB; this exceeds GitHub's file size limit of 100.00 MB failed to push some refs to 'https://github.com/lewyuejian/autoShellScript.git'

    命令链接 https://www.cnblogs.com/mrzll/p/12049280.html

  • 相关阅读:
    重建Exchange邮件系统的系统邮箱
    枚举算法001
    关于网站备案的44个问题
    wireshack使用
    格言
    程序员遇到BUG的解释
    只要有信心任何事情都可以做成,今天表现不错哦,加油!
    踏实,自信
    学会经营自己的关系
    戒酒
  • 原文地址:https://www.cnblogs.com/yfacesclub/p/14160046.html
Copyright © 2020-2023  润新知