首页 > 其他分享 >SciTech-Github-解决git push时的 Error: hasDotgit: contains '.git'

SciTech-Github-解决git push时的 Error: hasDotgit: contains '.git'

时间:2024-01-10 12:22:20浏览次数:26  
标签:git contains tree object objects push hasDotgit

AbaelsMacBookPro:pelican abaelhe$ git push
Enumerating objects: 6872, done.
Counting objects: 100% (6872/6872), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4305/4305), done.
remote: error: object 93c3f3e6d30672571d972693d0842a14c4ffed26: hasDotgit: contains '.git'
remote: fatal: fsck error in packed object
error: remote unpack failed: index-pack failed
error: failed to push some refs to 
  '[email protected]:abaelhe/abaelhe.github.io.git'

Malformed objects in git repository #1692

I searched the issues for hasDotgit and found nobody reporting this issue yet.

I expected to be able to clone this git repository from Github but was unable to with the transfer.fsckobjects option set to true. When fetching objects from a remote this option will make git-fetch-pack check all fetched objects and abort when a malformed object or a broken link is encountered. See https://github.com/git/git/blob/d10e2cb9d0299a26f43d57dd5bdcf2b3f86a30b3/Documentation/config.txt#L2691-L2694 for information on transfer.fsckobjects option.

I tried to clone using the https, git and SSH methods of cloning from your organization's public repository URL. I also attempted to clone from a fork I created.

Here is an example of a failure. It fails on the same object SHA each time (031eba227fde3d82b8962537678701ac0cefbda6).

$ git clone git://github.com/zotonic/zotonic
Cloning into 'zotonic'...
remote: Counting objects: 86634, done.
error: object 031eba227fde3d82b8962537678701ac0cefbda6: hasDotgit: contains '.git'
fatal: Error in object
fatal: index-pack failed

I suggest you run the following to report all of the malformed objects or broken links in the repository since this option will only fail on the first problematic object in the git database.

$ git fsck --full                                      
Checking object directories: 100% (256/256), done.    
warning in tree 031eba227fde3d82b8962537678701ac0cefbda6: hasDotgit: contains '.git'
warning in tree 0c8472159b917c6e472a0f65b26be31a57021499: hasDotgit: contains '.git'
warning in tree 14a5cae41e98f08fd2f6d807283f07fc6141e8e9: hasDotgit: contains '.git'
Checking objects: 100% (86634/86634), done.

For reference here is the pertinent git config information for this problem:

$ git config transfer.fsckobjects
true
$ git --version
git version 2.12.2

The git config option fetch.fsckobjects set to true will also cause this error to surface.

When I searched for this tree SHA I found the following reference to it: http://chatlogs.jabber.ru/[email protected]/2013/01/11.html

It lists the tree object looking like:

$ git ls-tree 031eba227fde3d82b8962537678701ac0cefbda6
040000 tree cd78065b172904253f823ac55e3210370af1cda1    .git
100644 blob a961122cf332c52bee5e678dd6243515a376c554    Emakefile
100644 blob 08b71726713a5840d2fbe9f671486f1468ddc8f9    License.txt
100644 blob f6aedc90f44016ba45ee6c4b012511cab194a638    Makefile
100644 blob d2ff5f9beb73303a38c88c6be7291bd56ff6a4ce    README.txt
040000 tree 6532097400540586342df1748ae64f3456b21652    ebin
040000 tree 0d4e2865bd5c984d6563701231b3b2b9bc58fcec    src

It appears as if the reason this tree object is malformed is because it contains a .git tree (aka directory) which is a little inception-like.

The date on the chat references is from 2012, so the commit is definitely not new.

I am not sure what can be done here but thought I would let you know that this will impact more and more people as checking git object integrity and links becomes more important from a security perspective.

标签:git,contains,tree,object,objects,push,hasDotgit
From: https://www.cnblogs.com/abaelhe/p/17956228

相关文章

  • git配置SSH服务
    一:概述在管理git项目上,一般有httpsurl和sshurl两种方式克隆到本地。这两种方式的主要区别在于:使用httpsurl克隆对初学者来说会比较方便,复制httpsurl然后到gitBash里面直接使用clone命令克隆到本地即可,但是每次fetch和push代码都需要输入账号和密码,这也是https方式的麻烦之处。......
  • uniapp里面.map文件是什么,如何在git提交时避免提交
    在UniApp中,.map文件是源代码映射文件,通常与JavaScript文件一起生成。这个文件的主要目的是为了在开发过程中和调试阶段中提供更好的调试支持。它包含了源代码与压缩混淆后的代码之间的映射关系,使得在调试器中能够追踪到源代码的位置。.map文件通常由构建工具(如Webpack、Rollup......
  • git增加代理设置
    问题默认的git下载很慢,想加速配置代理[root@lab201nfs-ganesha]#cat/root/.gitconfig[user] [email protected] name=zphj1987[credential] helper=store[push] default=simple[http]proxy=http://192.168.0.12:7890[https]proxy=......
  • 无涯教程-Redis - RPOPLPUSH命令函数
    RedisRPOPLPUSH命令返回并删除源(source)中存储的列表的最后一个元素,并将该元素压入存储在目标位置的列表的第一个元素(头)。RPOPLPUSH-返回值返回被弹出的最后一个元素。RPOPLPUSH-语法以下是RedisRPOPLPUSH命令的基本语法。redis127.0.0.1:6379>RPOPLPUSHSOU......
  • gitlab升级
    升级环境:操作系统:Centos7.6gitlab版本:gitlab-ce-14.9.0升级至gitlab-ce-15.0.5参考文档:https://docs.gitlab.com/ee/update/index.html#upgrade-paths注意事项:升级期间gitlab会停止对外服务,做任何系统升级前都需要提前做好数据备份,避免升级失败导致数据丢失。1、数据备份执行如下......
  • 无涯教程-Redis - LPUSH命令函数
    RedisLPUSH命令将所有指定的值插入存储在键处的列表的开头,如果键不存在,则创建空列表,当键包含的值不是列表时,将返回错误。LPUSH-返回值返回操作后列表的长度。LPUSH-语法以下是RedisLPUSH命令的基本语法。redis127.0.0.1:6379>LPUSHKEY_NAMEVALUE1..VALUENLP......
  • git gitignore
    在Git中,可以通过创建.gitignore文件来指定要忽略的文件或文件夹。首先,进入项目所在的根目录。打开命令行工具(如Terminal)并输入以下命令创建.gitignore文件:touch.gitignore使用任意编辑器打开.gitignore文件,将需要忽略的文件夹路径添加到该文件中。每个路径应单独写在新的一行上。......
  • 无涯教程-Redis - BRPOPLPUSH命令函数
    RedisBRPOPLPUSH命令用于从列表中返回一个值,或者阻塞直到一个可用,BRPOPLPUSH命令仅返回最后一个元素并将其插入到另一个列表(如果有)中,或者在特定时间内阻止客户端执行任何命令。BRPOPLPUSH-返回值如果键存在,则返回值,否则返回nil。BRPOPLPUSH-语法以下是RedisBRPOP......
  • 如何在GitHub正确提PR(Pull Requests),给喜欢的开源项目贡献代码
    最好的中文TTS项目Bert-vits2更新了中文特化分支,但可能由于时间仓促,代码中存在不少的bug,作为普通用户,有的时候也想为自己喜欢的开源项目做一点点贡献,帮助作者修改一些简单的bug,那么该如何开始?本次我们以Bert-vits2项目为例子,分享正确提交PR(PullRequests)的方式。FORK项目首......
  • ​Github揽获3k+星!清华开源CogAgent:基于多模态大模型的GUI Agent
    前言 本文提出了视觉GUIAgent,使用视觉模态(而非文本)对GUI界面进行更全面直接的感知,从而做出规划和决策。对此,我们研发了多模态大模型CogAgent,可接受1120×1120的高分辨率图像输入,不仅提升了通用视觉理解能力,还具备强大的GUIAgent能力。本文转载自PaperWeekly仅用于学......