Can't import git repository to azure devops due to a corrupted commit. (Can clone it down locally): Any advice on how to work around?

我只是一个虾纸丫 提交于 2020-04-18 05:30:13

问题


I've been trying to import libre core (https://github.com/LibreOffice/core) to an azure devops repo. The url I am closing is: https://github.com/LibreOffice/core.git

The import keeps failing with error:

Oops! Your import of https://github.com/LibreOffice/core.git repository failed due to The commit object 657924e4d73d6d501c9a3ceaf62e29b8f243cead was rejected: Commit parse failed due to author identity failed to parse: Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com>>

Maybe it's due to the extra < in the author? So I've tried importing this to another github repo and that still fails which suggests it's not just an azure devops problem.

I'm able to clone the repo locally but when I try and push that to azure devops I get the same error. I've also tried looking at potentially finding the commit and changing the author but because there's over 400,000 commits and this one is fairly early on my computer crashes when trying out various methods I've read here

Any advice on how to work around this would be really great!!

Added below output from fast export and import command:

Alloc'd objects:    4615000
Total objects:      4614971 (    426688 duplicates                  )
      blobs  :      1635681 (         0 duplicates    1511600 deltas of    1616683 attempts)
      trees  :      2531286 (    426688 duplicates    2306584 deltas of    2490676 attempts)
      commits:       448004 (         0 duplicates          0 deltas of          0 attempts)
      tags   :            0 (         0 duplicates          0 deltas of          0 attempts)
Total branches:           1 (         1 loads     )
      marks:     1073741824 (   2083685 unique    )
      atoms:          87634
Memory total:        246981 KiB
       pools:         30653 KiB
     objects:        216328 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 35184372088832
pack_report: pack_used_ctr            =     429158
pack_report: pack_mmap_calls          =      32709
pack_report: pack_open_windows        =          1 /          9
pack_report: pack_mapped              =  214272731 / 9353540391
---------------------------------------------------------------------

And the command I'm running is:

git fast-export master| sed -e 's/<Joerg Skottke \[jsk\] jsk@openoffice.org>>/<jsk@openoffice.org>/' -e 's/Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com>>/Andre Fischer <andre.f.fischer@oracle.com>/' -e 's/Andre Fischer<Andre.W.Fischer <Andre Fischer<Andre.W.Fischer@Sun.COM>>/Andre Fischer <andre.f.fischer@oracle.com>/'  -e 's/Gregor Hartmann<gh <Gregor Hartmann<gh@openoffice.org>>/Joerg Skottke <jsk@openoffice.org>/' | (cd ../new-repo && git fast-import)

回答1:


Most Git hosting providers run with transfer.fsckObjects on all their repositories so that any invalid, corrupt, or malicious commit is rejected immediately. This prevents people from pushing objects using broken tools or exploiting security vulnerabilities in older clients.

However, that tends to cause problems for well-known repositories with corrupted commits, such as this LibreOffice one. The extra angle brackets are definitely not allowed here and Git is rejecting the commit due to them.

Some hosting providers can relax one or more checks for an import of an existing, well-known repository, so it would be worth asking Azure DevOps support if that's a thing they can do. If not, your best best would be to use git fast-export to export the repository, modify the stream to fix the author (and if necessary, committer) identities, and then import it into a fresh repository using git fast-import. Note that doing so will change the object IDs of any commits starting at the invalid one and invalidating any subsequent tag signatures.

You can do this with something like the following:

$ git init ../new-repo
$ git fast-export | \
  perl -pe 's/(author|committer) Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com>>/$1 Andre Fischer <andre.f.fischer@oracle.com>/' | \
  (cd ../new-repo && git fast-import)


来源:https://stackoverflow.com/questions/60757335/cant-import-git-repository-to-azure-devops-due-to-a-corrupted-commit-can-clon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!