When I tried to run
git push origin master --force
I just got
Counting objects: 2649, done.
Delta compression uses up to 2 threads.
Compressing objects: 100% (1280/1280), done.
error: RPC failed; result=22, HTTP code = 413 | 116 KiB/s
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2504/2504), 449.61 MiB | 4.19 MiB/s, done.
Total 2504 (delta 1309), reused 2242 (delta 1216)
fatal: The remote end hung up unexpectedly
Everything up-to-date
Is it something to do with not being secure? I tried creating a public key as the answer for Fatal: The remote end hung up unexpectedly and rerunning it, but it still doesn’t work. Am I not actually using the key? If so, how do I use it?
asked Mar 6, 2013 at 6:51
7
This is due to git/https buffer settings.
Run this (taken from Git fails when pushing commit to github):
git config http.postBuffer 524288000
Then, run your original command again.
Mateen Ulhaq
23k16 gold badges89 silver badges130 bronze badges
answered Apr 6, 2013 at 13:24
Roman MRoman M
8,2032 gold badges14 silver badges17 bronze badges
16
Cause: The default file post size for Git has been exceeded.
Solution: Navigate to repo. Run the following command to increase the buffer to 500MB after navigating to the repository:
git config http.postBuffer 524288000
Mateen Ulhaq
23k16 gold badges89 silver badges130 bronze badges
answered Sep 9, 2013 at 11:05
ChinuChinu
1,2791 gold badge8 silver badges2 bronze badges
6
You might get an error like this
error: could not lock config file .git/config: No such file or
directory
that is because you don’t have a local .git/config
file You can get it working by this command:
git config --global http.postBuffer 524288000
nik7
8073 gold badges11 silver badges20 bronze badges
answered Sep 1, 2015 at 10:35
niksmacniksmac
2,6293 gold badges32 silver badges48 bronze badges
3
Culprit (in my case):
A high-latency network.
This is not an answer per se but more of an observation that may help others. I found that this error pops up occasionally on high-latency networks (I have to use a Satellite dish for internet access for example). The speed of the network is fine, but the latency can be high. Note: The problem only exists in certain scenarios, but I have not determined what the pattern is.
Temporary mitigation:
I switched networks—I moved to a slower, but lower latency cell network (my phone used as a hotspot)—and the problem disappeared. Note that I can only do this itermittently because my cell connectivity is also intermittent. Plus the bandwidth usage adds costs. I’m also lucky that I have this option available to me. Not everyone does.
I’m sure there is some configuration setting somewhere that makes git—or ssh or curl or whatever times out first—more tolerant of such networks, but I don’t know what it is.
A plea to developers:
These kinds of issues are a constant problem for rural populations. Please think of us when you design your systems, tools, and applications. Thank you.
answered Mar 31, 2020 at 15:36
t0ddt0dd
4914 silver badges2 bronze badges
2
Other solutions didn’t work in my case, doing a garbage collection fixed it for me:
git gc --aggressive
You can try with just git gc
first.
nik7
8073 gold badges11 silver badges20 bronze badges
answered May 27, 2016 at 17:01
ShameenShameen
2,4981 gold badge14 silver badges21 bronze badges
4
Contrary to one of the other answers — I had the problem on push using ssh — I switched to https and it was fixed.
git remote remove origin
git remote add origin https://github.com/user/repo
git push --set-upstream origin master
answered Apr 14, 2016 at 8:57
MikeBMikeB
8988 silver badges23 bronze badges
3
If using GitHub, in the repo’s directory, run this command to set http.postBuffer
to what appears to be its maximum allowable value for GitHub:
git config http.postBuffer 2147483648
If cloning a repo instead using git clone
, it can be cloned with the same option:
git clone -c http.postBuffer=2147483648 git@github.com:myuser/myrepo.git /path/to/myrepo
In both cases, the number above is equivalent to 2 GiB. It is however possible that you will need up to this amount of free memory to be able to use this value.
Ensure that each push to GitHub has commits that don’t add more than this size of changes. In fact I would keep the commit push size under 1.8 GiB to be safe. This can require dividing a large commit into smaller commits and pushes.
Why this value?
This specific value is used because at least as of the year 2018, this value was documented (archive link) as the push size limit of GitHub:
we don’t allow pushes over 2GB
Why not set lower?
Some prior answers say to set it to 524288000 (500 MiB), but this number seems arbitrary and without merit. Any lower value should work as long as your push size is not larger than the set value.
Why not set higher?
If instead you set the value to higher than 2 GiB, and if your attempted push size is also higher, you can expect the documented error with GitHub:
remote: fatal: pack exceeds maximum allowed size
answered Oct 28, 2020 at 2:11
AsclepiusAsclepius
54.5k16 gold badges157 silver badges139 bronze badges
This error can also be thrown through missing write permissions on the repository.
My concrete case went like this:
- I created a repo with the
root
user of my server (via SSH). - I installed a git service and created a
git
linux user that should manage all git-related action. - By that time, I had forgotten that the repo was created with the
root
user in the first place, and thegit
user simply didn’t have the file permissions to write anything into the repository.
answered Jul 20, 2014 at 15:09
LoiloLoilo
12.8k8 gold badges36 silver badges46 bronze badges
Asclepius
54.5k16 gold badges157 silver badges139 bronze badges
answered Apr 30, 2020 at 5:11
HimalayanCoderHimalayanCoder
9,4426 gold badges58 silver badges59 bronze badges
3
The following commands might help you…
git config --global http.postBuffer 1048576000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
answered Jul 26, 2021 at 15:56
1
In our case, the problem was a clone that wrote a .git/config
file which contained a url entry that was a read only access method. Changing the url from the ://
method to the @
method fixed the problem.
Running git remote -v
illuminated the issue some.
rayryeng
102k22 gold badges185 silver badges189 bronze badges
answered Jul 17, 2014 at 22:48
Frank PFrank P
591 silver badge1 bronze badge
Even after configuring post buffer the issue was not resolved.
My problem was solved when I changed my wifi network from broadband to my mobile hotspot. This might not be the logically correct answer but it solved the issue.
Make sure you have good internet speed.
answered Apr 25, 2020 at 3:20
1
None of the above solutions worked for me, however the commit I was pushing was very large.
Very simply, I split it into two commits and pushed each one separately and it went through instantly.
answered Jul 7, 2021 at 1:15
user11809641user11809641
7651 gold badge10 silver badges21 bronze badges
2
Another addition, since I encountered this error a different way and Google took me here.
My problem was a mismatch of case; one camelCase and one not. Apparently, GIT stops you doing this without telling you why. So if your branches are different from the remote only in the capitalization, try changing them to be identical.
See:
Git: ‘Master cannot be resolved to branch’ after merge
answered Nov 30, 2015 at 12:38
ThomasThomas
3752 silver badges10 bronze badges
1
None of the above answers worked for me, but here’s what did.
- delete
.git/
from your project - clone the remote repo to some new location like your desktop:
git clone https://github.com/foo/bar.git
- move
.git/
from the new location into the old location - re-commit and push your changes
nik7
8073 gold badges11 silver badges20 bronze badges
answered Jan 16, 2020 at 19:23
BenBen
19.1k29 gold badges109 silver badges180 bronze badges
1
If you are using git for windows (and you likely are, if you are doing this on a windows machine), and none of the other fixes here worked for you, try going to https://github.com/git-for-windows/git/releases, and getting a version on or after version 2.4.5. Fixed it right up for me.
answered Jul 30, 2015 at 17:04
rrreeerrreee
7231 gold badge5 silver badges20 bronze badges
You probably did clone the repository within an existing one, to solve the problem can simply clone of the repository in another directory and replicate the changes to this new directory and then run the push.
answered Aug 30, 2015 at 2:45
1
In my case I got this error, when pushing with Intellij Idea.
Here is how I traced down my error and fixed it.
- enable debug logging within the terminal, which is never a bad idea
set GIT_CURL_VERBOSE=1 set GIT_TRACE=1
- push via the terminal, not via intellij
git push
-> fatal: The current branch feature/my-new-feature has no upstream branch.
To push the current branch and set the remote as upstream
Solution was to set the upstream, which must have been gone wrong before:
git push --set-upstream origin feature/my-new-feature
answered Apr 22, 2020 at 10:39
LamaLama
2,8065 gold badges42 silver badges57 bronze badges
I solved this issue by repacking:
git repack --max-pack-size=100M -a -d
Go to Repository > Open in command prompt in GitHub Desktop
Run the following commands:
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
git push origin <branch>
answered Mar 15, 2021 at 22:48
This may occur after updating your OSX platform.
Open Terminal and navigate to your .ssh-folder, and enter ssh-add -K ~/.ssh/id_rsa
answered Dec 7, 2016 at 10:23
cptstarlingcptstarling
7696 silver badges11 bronze badges
PLESK Nginx and GIT
I was getting this error on plesk git and while pushing a large repo with (who knows what) it gave me this error with HTTP code 413 and i looked into following
Server was Plesk and it had nginx running as well as apache2 so i looked into logs and found the error in nginx logs
Followed this link to allow plesk to rebuild configuration with larger file upload.
I skipped the php part for git
After that git push worked without any errors.
answered Apr 5, 2019 at 12:58
Farrukh SubhaniFarrukh Subhani
1,9901 gold badge16 silver badges24 bronze badges
For us the problem was that we had a ton of files that should have instead been managed by git lfs.
We did the following to resolve the problem:
# Soft reset so you can author a new commit
git reset --soft HEAD~1
# Install git lfs
git lfs install
# Track large files of a specified file type YMMV
git lfs track "*.uasset" "*.umap"
# Re-add everything
git add .
# Author a new commit
git commit -m "git lfs ftw"
# Push
git push
answered Dec 16, 2021 at 23:17
bobbyg603bobbyg603
3,3952 gold badges18 silver badges30 bronze badges
Recently I faced the same problem. When cloning a remote repository I got the error as follows:
fatal: the remote end hung up unexpectedly MiB | 7.00 KiB/s
fatal: early EOF
index-pack failed
When I googled the error I was redirected here. And I followed most of the answers but not solved my problem.
The only solution was to re-install my ‘Network adapter (WiFi) driver software‘. So, what I want to emphasize is the above error can result from the issues in your PC’s WiFi driver software, too. If non of the mentioned answers are not working then you can try reinstalling the WiFi driver. It will solve the issue.
You can easily reinstall the WiFi driver as follows:
-
Open network and internet settings
-
Select ‘Network reset’
-
Then select ‘Reset now’
After rebooting your pc, try git operations successfully (pushing/pulling/cloning).
answered Apr 15, 2021 at 22:13
I happened to have the same error at pull.
I have done the «http.postBuffer» trick. It solved it, but when I wanted to push, I encountered the error again.
What solved my problem:
1. Cloned it to an other folder with an other virtual machine. (Linux).
2. I’ve done my changes.
3. Pushed it with the original virtual machine where I initially couldn’t push. (Windows)
answered Jun 22, 2015 at 17:12
nopara73nopara73
4926 silver badges24 bronze badges
2
I have the same problem. I noticed from the git web page that the SSH clone URL have the next structure:
git@github.com:user/project.git
I could resolve my problem just changing the «:» by «/», as follows:
git@github.com/user/project.git
may be this can be helpful.
Jai Chauhan
3,8153 gold badges36 silver badges58 bronze badges
answered Aug 30, 2015 at 19:51
Seems like it can be one of a thousand things.
For me, I was initially pushing master and develop (master had no changes) via SourceTree. Changing this to develop only worked.
answered Jul 23, 2017 at 0:07
Jake LeeJake Lee
7,3748 gold badges45 silver badges85 bronze badges
I was facing a similar error uploading a large repo, «fatal: The remote end hung up unexpectedly» without any further details.
After a lot of research, here’s what I did:
- Using SSH instead of HTTPS, didn’t solve the problem.
- Increasing http.postBuffer incrementally up to a very large value, still no
luck. - I figured out that it might be because of large files in
the repo (as this is a newly migrated repo from perforce), so I recreated the repo using LFS, setting largeFileThreshold to 40m, which greatly reduced the repo size (from 3.5G to 500M).
I thought this will solve the problem, but to my surprise I still faced the same error.
Finally, it occurred to me that may be I’m using an older git client, as I didn’t see additional error messages.
I upgraded git client to latest (2.20.1), and voila, the error is gone!
answered Jan 10, 2019 at 21:20
4
Seems almost pointless to add an answer, but I was fighting this for ages when I finally discovered it was Visual Studio Online that was suffering a sporadic outage. That became apparent when VS kept prompting for creds and the VSO website sometimes gave a 500.
Counting objects: 138816, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (38049/38049), done.
error: unable to rewind rpc post data - try increasing http.postBuffer
error: RPC failed; curl 56 SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
The remote end hung up unexpectedly/138816), 33.30 MiB | 3.00 KiB/s
Writing objects: 100% (138816/138816), 50.21 MiB | 3.00 KiB/s, done.
Total 138816 (delta 100197), reused 134574 (delta 96515)
fatal: The remote end hung up unexpectedly
Everything up-to-date
I set my HTTP post buffer back to 2 MB afterwards, since I actually think it works better with many smaller posts.
Asclepius
54.5k16 gold badges157 silver badges139 bronze badges
answered May 12, 2016 at 8:52
Luke PuplettLuke Puplett
40.9k43 gold badges174 silver badges260 bronze badges
Иногда при работе с git через http возникает ошибка The remote end hung up unexpectedly
. Это может обозначать одну из нескольких проблем. Одна из проблем — размер репозитория больше максимально допустимого размера будефа POST. Рассмотрим решение данной проблемы.
Вывод о данной ошибке выглядит примерно следующим образом:
Counting objects: 7928, done. Delta compression using up to 12 threads. Compressing objects: 100% (7834/7834), done. Writing objects: 100% (7928/7928), 204.43 MiB | 97.40 MiB/s, done. Total 7928 (delta 968), reused 1 (delta 0) error: RPC failed; result=22, HTTP code = 413 fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date
Итак, первый вариант решения данной проблемы состоит в увеличении буфера данных POST запроса.
В первую очередь необхожимо узнать размер данных. В приведенном выше примере вывода размер равен 204.43 МБ. К этому числу добавим небольшой запас (например, до 250 МБ) и переведем все в байты. 250 МБ = 250 * 1024 * 1024 = 262144000 КБ. Задаем полученное значение в настройки git.
git config http.postBuffer 262144000
Этой командой мы выставили значение для конкретного репозитория, если необходимо применить данную настройку глобально, то необходимо добавить флаг —global:
git config --global http.postBuffer 262144000
Если ваш сервер для хранения git репозиториев имеет максимальный размер тела запроса меньше заданного размера, то необходимо перенастроить web-сервер (если есть такая возможность). Для этого необходимо изменить значение client_max_body_size
(для nginx) или LimitRequestBody
(для apache) и перезагрузить сервис (service nginx reload
или service apache2 reload
соответственно). Если сервер не аш и нет возможности его сконфигурировать, то остается вариант номер 2.
Второй вариант заключается в переходе с протокола http на ssh. Вам будет необходимо изменить адрес удаленного репозитория с помощью команды git remote set-url
:
git remote set-url origin git@example.com:user/repository.git
Вот мы рассмотрели два пути решения ошибки The remote end hung up unexpectedly
. Вероятно есть другие причины возникновения данной ошибки и иные пути решения. Эта статья не охватывает все возможные варианты, но надеюсь, что она вам помогла.
- 2015-07-18 08:31:22
Problem
When users try to run «git push» the following error message is shown:
$ git push
Counting objects: 2332669, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (360818/360818), done.
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2332669/2332669), 483.30 MiB | 114.26 MiB/s, done.
Total 2332669 (delta 1949888), reused 2330461 (delta 1949349)
fatal: The remote end hung up unexpectedly
Cause
The «Smart HTTP» protocol in Git uses «Transfer-Encoding: chunked» in POST requests when it contains packed objects greater than 1MB in size.
Some proxy servers, like Nginx, do not support this transfer encoding by default, and the requests will be rejected before they get to Bitbucket Server. Because of this, the Bitbucket Server logs will not show any extra information.
Another possible cause is a load balancer misconfiguration.
Workaround
-
When pushing a large amount of data (initial push of a big repository, change with very big file(s)) may require a higher
http.postBuffer
setting on your git client (not the server). From https://www.kernel.org/pub/software/scm/git/docs/git-config.htmlhttp.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.
- Configuration on your reverse proxy. Usually ngnix the parameter
client_max_body_size
is a blocker. The reverse proxy may also have a connection timeout that’s closing the connection (e.g.TimeOut
orProxyTimeout
in apache,proxy_read_timeout
in ngnix). Try bypassing the proxy by pushing directly to Bitbucket Server IP:port. If this works, it’s highly likely that the proxy server is causing the early disconnect and needs to be tuned. - User is using an outbound proxy on his machine that is causing the issue.
Resolution
-
Increase the Git buffer size to the largest individual file size of your repo:
git config --global http.postBuffer 157286400
-
Refer to the resolution of Git push fails — client intended to send too large chunked body for ngnix reverse proxy configuration. Increase this parameter to the largest individual file size of your repo.
-
Bypass the outbound proxy as explained on Can’t clone or pull due to a git outbound proxy
Sometimes things don’t work the way they should or as you might expect when
you’re using Git. Here are some tips on troubleshooting and resolving issues
with Git.
Broken pipe errors on git push
‘Broken pipe’ errors can occur when attempting to push to a remote repository.
When pushing you usually see:
Write failed: Broken pipe
fatal: The remote end hung up unexpectedly
To fix this issue, here are some possible solutions.
Increase the POST buffer size in Git
If you’re using Git over HTTP instead of SSH, you can try increasing the POST buffer size in Git’s
configuration.
Example of an error during a clone:
fatal: pack has bad object at offset XXXXXXXXX: inflate returned -5
Open a terminal and enter:
git config http.postBuffer 52428800
The value is specified in bytes, so in the above case the buffer size has been
set to 50MB. The default is 1MB.
Check your SSH configuration
If pushing over SSH, first check your SSH configuration as ‘Broken pipe’
errors can sometimes be caused by underlying issues with SSH (such as
authentication). Make sure that SSH is correctly configured by following the
instructions in the SSH troubleshooting documentation.
If you’re a GitLab administrator with server access, you can also prevent
session timeouts by configuring SSH keep-alive
on the client or the server.
NOTE:
Configuring both the client and the server is unnecessary.
To configure SSH on the client side:
-
On UNIX, edit
~/.ssh/config
(create the file if it doesn’t exist) and
add or edit:Host your-gitlab-instance-url.com ServerAliveInterval 60 ServerAliveCountMax 5
-
On Windows, if you are using PuTTY, go to your session properties, then
navigate to «Connection» and under «Sending of null packets to keep
session active», setSeconds between keepalives (0 to turn off)
to60
.
To configure SSH on the server side, edit /etc/ssh/sshd_config
and add:
ClientAliveInterval 60
ClientAliveCountMax 5
Running a git repack
If ‘pack-objects’ type errors are also being displayed, you can try to
run a git repack
before attempting to push to the remote repository again:
git repack
git push
Upgrade your Git client
In case you’re running an older version of Git (< 2.9), consider upgrading
to >= 2.9 (see Broken pipe when pushing to Git repository).
ssh_exchange_identification
error
Users may experience the following error when attempting to push or pull
using Git over SSH:
Please make sure you have the correct access rights
and the repository exists.
...
ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
or
ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly
This error usually indicates that SSH daemon’s MaxStartups
value is throttling
SSH connections. This setting specifies the maximum number of concurrent, unauthenticated
connections to the SSH daemon. This affects users with proper authentication
credentials (SSH keys) because every connection is ‘unauthenticated’ in the
beginning. The default value is 10
.
Increase MaxStartups
on the GitLab server
by adding or modifying the value in /etc/ssh/sshd_config
:
MaxStartups 100:30:200
100:30:200
means up to 100 SSH sessions are allowed without restriction,
after which 30% of connections are dropped until reaching an absolute maximum of 200.
Once configured, restart the SSH daemon for the change to take effect.
# Debian/Ubuntu
sudo systemctl restart ssh
# CentOS/RHEL
sudo service sshd restart
Timeout during git push
/ git pull
If pulling/pushing from/to your repository ends up taking more than 50 seconds,
a timeout is issued. It contains a log of the number of operations performed
and their respective timings, like the example below:
remote: Running checks for branch: master
remote: Scanning for LFS objects... (153ms)
remote: Calculating new repository size... (cancelled after 729ms)
This could be used to further investigate what operation is performing poorly
and provide GitLab with more information on how to improve the service.
git clone
over HTTP fails with transfer closed with outstanding read data remaining
error
Sometimes, when cloning old or large repositories, the following error is thrown:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
This is a common problem with Git itself, due to its inability to handle large files or large quantities of files.
Git LFS was created to work around this problem; however, even it has limitations. It’s usually due to one of these reasons:
- The number of files in the repository.
- The number of revisions in the history.
- The existence of large files in the repository.
The root causes vary, so multiple potential solutions exist, and you may need to
apply more than one:
-
If this error occurs when cloning a large repository, you can
decrease the cloning depth
to a value of1
. For example:variables: GIT_DEPTH: 1
-
You can increase the
http.postBuffer
value in your local Git configuration from the default 1 MB value to a value greater
than the repository size. For example, ifgit clone
fails when cloning a 500 MB
repository, you should sethttp.postBuffer
to524288000
:# Set the http.postBuffer size, in bytes git config http.postBuffer 524288000
-
You can increase the
http.postBuffer
on the server side:-
Modify the GitLab instance’s
gitlab.rb
file:omnibus_gitconfig['system'] = { # Set the http.postBuffer size, in bytes "http" => ["postBuffer" => 524288000] }
-
After applying this change, apply the configuration change:
sudo gitlab-ctl reconfigure
-
For example, if a repository has a very long history and no large files, changing
the depth should fix the problem. However, if a repository has very large files,
even a depth of 1 may be too large, thus requiring the postBuffer
change.
If you increase your local postBuffer
but the NGINX value on the backend is still
too small, the error persists.
Modifying the server is not always an option, and introduces more potential risk.
Attempt local changes first.