Git提交push报错:HTTP 413 curl 22 The requested URL returned error 413 解决方案(超详细步骤)

Git提交push报错:HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large解决方案(超详细步骤)

文章目录

  • Git提交push报错:HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large解决方案(超详细步骤)
  • 前言
  • 错误
  • 解决方法
    • 1.检查现有 SSH 密钥
    • 2.生成新 SSH 密钥并添加到 ssh-agent
      • 生成新 SSH 密钥
      • 将 SSH 密钥添加到 ssh-agent
  • 3.新增 SSH 密钥到 GitHub 帐户
  • 4.更改远程仓库的 URL
      • 将远程 URL 从 SSH 切换到 HTTPS
      • 将远程 URL 从 HTTPS 切换到 SSH
      • 疑难解答
        • [No such remote 'name]'
  • 测试 SSH 连接
  • 使用 SSH 密钥密码
      • 添加或更改密码
      • 在 Git for Windows 上自动启动 ssh-agent

前言

提交代码push的时候报错:HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

原因是上传的文件过大,所以会出现以下的错误信息。网上的改法没有用,只能通过使用ssh方式提交才能解决。因此这里给出解决方法。

错误

Total 45 (delta 12), reused 0 (delta 0), pack-reused 0
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly

解决方法

如果你已经配置好了ssh密钥,可以直接跳到第四步。

1.检查现有 SSH 密钥

在生成 SSH 密钥之前,您可以检查是否有任何现有的 SSH 密钥。

注: DSA 密钥 (SSH-DSS) 不再受支持。 现有密钥将继续运行,但您不能将新的 DSA 密钥添加到您的 GitHub 帐户。

  1. 打开 Git Bash。

  2. 输入 ls -al ~/.ssh 以查看是否存在现有 SSH 密钥:

    $ ls -al ~/.ssh
    # Lists the files in your .ssh directory, if they exist
    
  3. 检查目录列表以查看是否已经有 SSH 公钥。 默认情况下,公钥的文件名是以下之一:

    • id_rsa.pub
    • id_ecdsa.pub
    • id_ed25519.pub

如果您没有现有的公钥和私钥对,或者不想使用任何可用于连接到 GitHub 的密钥对,则生成新的 SSH 密钥

如果您看到列出的现有公钥和私钥对(例如 id_rsa.pub 和 id_rsa),并且您希望使用它们连接到 GitHub,则可以将 SSH 密钥添加到 ssh-agent

提示:如果您收到错误“~/.ssh 不存在”,不要担心! 我们在生成新的 SSH 密钥时会创建它。

2.生成新 SSH 密钥并添加到 ssh-agent

检查现有 SSH 密钥后,您可以生成新 SSH 密钥以用于身份验证,然后将其添加到 ssh-agent。

如果您还没有 SSH 密钥,则必须生成新 SSH 密钥。 如果您不确定是否已有 SSH 密钥,请检查现有密钥

如果不想在每次使用 SSH 密钥时重新输入密码,您可以将密钥添加到 SSH 代理,让它管理您的 SSH 密钥并记住您的密码。

生成新 SSH 密钥

  1. 打开 Git Bash。

  2. 粘贴下面的文本(替换为您的 GitHub 电子邮件地址)。

    $ ssh-keygen -t ed25519 -C "[email protected]"
    

    **注:**如果您使用的是不支持 Ed25519 算法的旧系统,请使用以下命令:

    $ ssh-keygen -t rsa -b 4096 -C "[email protected]"
    

    这将创建以所提供的电子邮件地址为标签的新 SSH 密钥。

    > Generating public/private ed25519 key pair.
    
  3. 提示您“Enter a file in which to save the key(输入要保存密钥的文件)”时,按 Enter 键。 这将接受默认文件位置。

    > Enter a file in which to save the key (/c/Users/you/.ssh/id_ed25519):[Press enter]
    
  4. 在提示时输入安全密码。 更多信息请参阅“使用 SSH 密钥密码”。

    > Enter passphrase (empty for no passphrase): [Type a passphrase

你可能感兴趣的:(Tools,java,git,github,idea)