特别是在 git 推送到 Microsoft Azure 时出现 HTTP 413 错误

问题描述 投票:0回答:2

我在微软论坛上问过这个问题,答案说我应该在另一个微软论坛上问。那个论坛说我应该问自动化MS的事情或者来这里。简而言之,我不指望 MS 能帮助我解决这个问题。无论如何...

我正在将一些存储库从 Mercurial 迁移到 Git(使用 fast-export)。实际的过渡很好:历史完整无损,分支都在那里。

但是,我无法将其中一些新存储库推送到 MS Azure。我将在这里介绍最大的(也是最关键的)一个。它给出以下错误。

$ git push -u origin --all
Enumerating objects: 138051, done.
Counting objects: 100% (138051/138051), done.
Delta compression using up to 12 threads
Compressing objects: 100% (43406/43406), done.
Writing objects: 100% (138051/138051), 202.73 MiB | 76.12 MiB/s, done.
Total 138051 (delta 94104), reused 137561 (delta 93696), pack-reused 0
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

存储库刚刚超过 1 GB,其中大部分是包文件。为了避免大文件阻碍我推送,我使用 git repack 并将其分成 10 个 ~100MB 的文件。我没有在 Azure 上设置最大推送大小,并且此存储库中没有单个文件超过 100 MB。

我在几个网站上阅读了大量帖子,但他们的建议没有帮助。 我的配置文件设置如下。 (我们的主要分支称为“生产”。)

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignoreCase = false
[branch "Production"]
    remote = origin
    merge = refs/heads/Production
[http]
    postBuffer = 2147483648
[remote "origin"]
    url = ********
    fetch = +refs/heads/*:refs/remotes/origin/*

即使我将包文件保留为单个 1GB 文件,我也可以毫无问题地推送到 GitHub。我还可以将存储库从 GitHub 导入到 Azure(仍然使用 1 GB 包文件),但我的老板想知道是否有办法消除中间步骤。

我运行的是 Windows 11,并且尝试从命令行、PowerShell、Git Bash 和 Git 扩展进行推送,所有结果都相同。我什至尝试从 Windows 11 的 Linux VM 进行推送,但没有成功。

如果我做错了什么,我很想知道它是什么以及如何正确做。

git azure http http-status-code-413
2个回答
2
投票

一位同事建议通过 SSH 而不是 HTTPS 进行推送,效果很好!希望遇到同样问题的其他人也能从这个解决方案中受益。


0
投票

在使用 Nginx 反向代理的自托管 GitLab 上也是如此。

尝试这个配置并在推送时等待:

server {
    server_name git.domain.example;
    listen ssl;
    ssl_certificate ...;
    ssl_certificate_key ....;

    client_max_body_size 0;

    location / {
        proxy_pass http://127.0.0.1:<port>;
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.