Git pushing to new remote error

ⅰ亾dé卋堺 提交于 2019-12-25 06:23:03

问题


I have a local git repository with an existing remote on my harddrive. Now I wanted to move the repository to github and following the documentation I did the following:

git remote set-url origin https://github.com/xxx/xxx.git
git push -u origin master

but I am getting errors.

[user@machine folder]$ git push -u origin master
Username: 
Password: 
Counting objects: 7398, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2575/2575), done.
error: RPC failed; result=22, HTTP code = 0iB | 367.95 MiB/s   
fatal: The remote end hung up unexpectedly
Writing objects: 100% (7398/7398), 506.65 MiB | 367.95 MiB/s, done.
Total 7398 (delta 5083), reused 6965 (delta 4677)
fatal: The remote end hung up unexpectedly
fatal: expected ok/error, helper said '2004k¡oe󝭲>�Xx�FV.�Na�D�͂'

fatal: write error: Broken pipe

Most questions I found on stackoverflow were solved by

git config http.postBuffer 524288000

But it doesn't help me I also tried git repack which just made the error come up faster (and a bit less gibberish printed out).

Before git repack the error looked like this:

[user@machine folder]$ git push -u origin master
Username: 
Password: 
Counting objects: 7398, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2771/2771), done.
error: RPC failed; result=22, HTTP code = 0iB | 11.89 MiB/s   
fatal: The remote end hung up unexpectedly
Writing objects: 100% (7398/7398), 506.60 MiB | 11.46 MiB/s, done.
Total 7398 (delta 5084), reused 6454 (delta 4481)
fatal: The remote end hung up unexpectedly
*�{�����@���߫��\l�|ʫ%r, helper said '2004�*U��m
                       ��EE$�%��M�l�\�yx�=�O�X.d (Y�gc�Ͷ�Ri�+�ONa���'���F�2X�P���򝠻���~�,�rݐ��޾��_�,����n0��~8(��v��_�lꉋ�=C�����M�ݓYP���ЖO�e�t-����2X��s�Ϲ۱�<�o|�+�6x1�ob��v>�s��'

I am pretty desperate at this point. Does anyone know how to push a local git repository to github?


回答1:


It can be due to several issues:

Repository size limit

  • github limit its repository size to GB (yours is ~500MB)
  • github limit the maximum of single file size to 100MB
    https://help.github.com/articles/working-with-large-files/

git config http.postBuffer 524288000

This config that you have set up is simply increasing the buffer size that git will use when sending data to the web

http.postBuffer
Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.


Wrong remote configuration.

Try to set the remote using this command: git remote add origin https://github.com/xxx/xxx.git in addition to the set-url that you have already added.


Your proxy settings

In some proxies there is a limit on the size of the post file, since your repository is big one (>500MB) it might be the case here.


What to do?

Try to eliminate the above possible issues by eliminating them one by one

  1. Commit fewer files and try to commit them. If this is working so the problem is with the size of the pack file that is being send over the network.
  2. Clean your repository with gc --aggressive --prune=now


来源:https://stackoverflow.com/questions/30477263/git-pushing-to-new-remote-error

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