error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

git首次提交代碼到遠程倉庫提示413錯誤,錯誤信息如下

git push --set-upstream origin master
Enumerating objects: 153, done.
Counting objects: 100% (153/153), done.
Delta compression using up to 4 threads
Compressing objects: 100% (133/133), done.
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
fatal: the remote end hung up unexpectedly
Writing objects: 100% (153/153), 30.44 MiB | 8.93 MiB/s, done.
Total 153 (delta 9), reused 0 (delta 0)
fatal: the remote end hung up unexpectedly
Everything up-to-date

 

踩坑記 

百度上很多文章的解決辦法是換成ssh協議,來連接遠程倉庫。這也是沒辦法的辦法,不優雅,不是作爲一個技術人妥協的藉口。

 

錯誤原因

http的413錯誤碼是請求體太大,那自然是服務器配置問題

由於我服務端是用nginx反向代理的,所以首先去改nginx配置

在http 的 server 節點中添加client_max_body_size配置如:

 

解決步驟

找到nginx配置文件 nginx.conf

find / -name nginx.conf

修改配置 

http {
  server {
    client_max_body_size 100m
    #其他配置
  }
  # 其他配置
}

重載配置,使其生效

nginx -s reload

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章