When uploading code to GitHub using git, the following error occurs:
It is true that there is a large amount of code uploaded at one time, and then expand the post buffer according to the scheme provided on the Internet, but it has no effect here. Maybe the buffer is not large enough, HHH. You can try this plan first.
git config http.postBuffer 524288000
Then, if it has not been solved, try the following scheme. We can see that the error message refers to http/2, so the solution is to switch back to http1 upload. After uploading, switch back to http2.
$ git config --global http.version HTTP/1.1
After it push was ok and I have changed HTTP version to 2 again:
$ git config --global http.version HTTP/2
However, things were always so bad, so I tried to switch to SSH connection.
git remote set-url origin [email protected]:{username}/{repository name}.git
However
Looking at this line of red and yellow characters, I knew early in the morning that the file was too large, but the above methods didn’t work here. Fortunately, GIT LFS was mentioned in the error prompt. OK, Download git LFS.
For Mac users:
brew install git-lfs
Then, under the project directory, execute:
git lfs install
Then, use git LFS to track the format of the large file you want to upload. What I upload here is in Bin format, so execute:
git lfs track "*.bin"
Then make sure . Gitattributes tracked to
git add .gitattributes
Then upload it