git push hangs after Total line
Asked Answered
G

39

329

My git push is hanging after appearing to complete the push. I am going git push

Counting objects: 51, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (47/47), 27.64 MiB | 6.47 MiB/s, done.
Total 47 (delta 4), reused 0 (delta 0)

It hangs here and I have to control-c to get back to command line. I have made several commits in the past with this project with no issues. I have tried other repos on my machine and they work fine. What is going on here?

Gallican answered 5/4, 2013 at 21:30 Comment(6)
Something like - "strace -efile -f git push" may reveal more about where the hangup is.Nagoya
Has anything changed on the remote repo? Such as having a long-running post-receive hook installed?Cucurbit
No. I'm using bitbucket, so I don't have access to everything. I'm starting to think it is just a big transfer that is taking a long time . Is there any kind of progress indicator when pushing?Gallican
Has something gone wrong with the permissions on the repo that you're pushing to, or is that location out of disk space. I've seen both problems. Also a git gc may help.Springe
Had exactly the same problem: in my case the git user on the server didn't own the bare repo - root owned it (had forgotten the -R in the chown)Jackstraw
The only thing that you need to do is waiting.Malka
G
235

This turned out to be no problem at all. I simply had to wait until the upload was complete. I had added several large files and there is not a progress indicator. Maybe someone else will find this helpful.

Gallican answered 18/4, 2013 at 13:32 Comment(12)
well 2kb file is not large in my case .... internet connection is awesome still hangs arghhhhManic
This was helpful. Good thing I didn't interrupt it :PIncidentally
I'm having a similar issue, but the Network indicator in Windows 8's Task Manager says 0% activity...Knifeedged
@Knifeedged - I get exactly the same - no apparent network activity (even though it was quite a big push) but then it finished OKCalefacient
It's a pretty bad designed interface, after "finishing" keep doing things with no user feedback.Thera
What worked for me was switching to a VPN. Must have been some routing problem with part of the traffic to Github.Yorgen
@Patrick It seems like you had 27.64 MB of files and yet you say you had to wait a while. I have 132.24 MB, I think 10 minutes passed, still waiting...Elspeth
6.78 MiB and it's been like 45 minutes already... :(Shakespeare
I have a push which is 27 MB and it hung for 24 hours already (I didn't even notice it hadn't worked, and came back to my computer to see the git push command was still hanging). Was very confused. Increasing the size of http.postBuffer as in Faiz Ahmad Dae's answer below fixed my problem.Tevere
I downvoted this answer because the answer below about increasing the http.postBuffer size is the real answer most people are probably looking for.Daye
I think it's more related to the connection itself and doesn't matter to the speed of the internet, I just changed the connection to 4g and worked instantly.Deccan
git config --global http.postBuffer 157286400 This is the correct answer. Following is where I found it.Strother
E
573

https://git-scm.com/docs/git-config#Documentation/git-config.txt-httppostBuffer

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.

Note that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard. Raising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes.

Resolution

  1. Increase the Git buffer size to the largest individual file size of your repo

  2. git config --global http.postBuffer 157286400

  3. 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.

  4. Bypass the outbound proxy as explained on Can't clone or pull due to a git outbound proxy

Extraversion answered 9/8, 2021 at 11:30 Comment(18)
Insane. No other solution worked for me. I wonder why it just hangs instead of printing an error message after waiting for hours...Nudicaul
Why 157286400 bytes (150 MiB)?Poultry
git config --global http.postBuffer 157286400 was ther answer. Probably would also have been fine with one less 0 on the end of that number.Jessamyn
it did worked for me as well. I was merging two repositories together, and the repo i was pushing was 500 mb big. The push was hanging, i updated the postBuffer, ran it again and it worked and pushed instantlyRosmunda
Looks like this works.. Fun how so many people here answer abut network activity and so on not realising how many people here have issues where it hangs for hours without any network activity and I can repeat and repeat and then miraculously it pass then again multiple times hangs.. so very bad issue no error nothing git has so flawed ui and everyone use it .. strange...Ledge
This was the solution for me as well. I anticipated something with the filesize, because I was uploading an MP4 file with a few MBs just before. But I stuck as I got no error messages. Neither from VSCODE nor at the CLI.Pejorative
git gc worked well for me. Source: https://mcmap.net/q/100672/-git-push-stuck-after-total-when-using-terminalExtinguisher
i have tried git gc git with option -f and http.postBuffer 157286400 still not work :(Supraliminal
@Jessamyn Thanks for sharing git config --global http.postBuffer 157286400 works for meShoring
Only steps 1 & 2 under Resolution were needed for me, which solved the problem! In other words: git config --global http.postBuffer 10000000. More detail, of course, is in git config --help.Sports
verbose showed me that "POST git-receive-pack (chunked)" was where it was hanging. This fixed the issue instantly. Thanks :)Hallucinate
insane, git config --global http.postBuffer 157286400 did not work and I have to double that size to make it work...Tippett
please somebody help me i tried http.postBuffer 157286400 but not workMenam
What a legend! Appreciate it.Kally
I tried with git config --global http.postBuffer 157286400. Result writing objects is now fast, but still a problem getting finished. THen I tried strace -efile -f git push and the result is amazing (for me) [pid 30018] newfstatat(1, "", 0x7ffebbea2520, AT_EMPTY_PATH) = -1 EBADF (Bad file descriptor) [pid 30018] +++ exited with 0 +++ ok, how to go on??Debussy
Even ChatGPT doesn't know this and it's from before it's training data cutoff dateFebri
Finally solution that helps! Much appreciated! ThanksShadrach
OMG bro!!! you are a genius! Thanks so much I would have NEVER figure this outGupton
G
235

This turned out to be no problem at all. I simply had to wait until the upload was complete. I had added several large files and there is not a progress indicator. Maybe someone else will find this helpful.

Gallican answered 18/4, 2013 at 13:32 Comment(12)
well 2kb file is not large in my case .... internet connection is awesome still hangs arghhhhManic
This was helpful. Good thing I didn't interrupt it :PIncidentally
I'm having a similar issue, but the Network indicator in Windows 8's Task Manager says 0% activity...Knifeedged
@Knifeedged - I get exactly the same - no apparent network activity (even though it was quite a big push) but then it finished OKCalefacient
It's a pretty bad designed interface, after "finishing" keep doing things with no user feedback.Thera
What worked for me was switching to a VPN. Must have been some routing problem with part of the traffic to Github.Yorgen
@Patrick It seems like you had 27.64 MB of files and yet you say you had to wait a while. I have 132.24 MB, I think 10 minutes passed, still waiting...Elspeth
6.78 MiB and it's been like 45 minutes already... :(Shakespeare
I have a push which is 27 MB and it hung for 24 hours already (I didn't even notice it hadn't worked, and came back to my computer to see the git push command was still hanging). Was very confused. Increasing the size of http.postBuffer as in Faiz Ahmad Dae's answer below fixed my problem.Tevere
I downvoted this answer because the answer below about increasing the http.postBuffer size is the real answer most people are probably looking for.Daye
I think it's more related to the connection itself and doesn't matter to the speed of the internet, I just changed the connection to 4g and worked instantly.Deccan
git config --global http.postBuffer 157286400 This is the correct answer. Following is where I found it.Strother
U
134

Try:

git gc

I had it hang at the same spot but with very small files, so waiting was not the answer. The solution was a git gc (garbage collection) to recalculate the deltas in the repo.

Ululant answered 31/7, 2022 at 3:39 Comment(8)
When I git pull --all I had same problem but I could fix it by git gc and then git pull --all again thanks.Vote
I removed a bunch of larger files at one time, and I think that was causing the issue on mine hanging up. This is the solution that worked for me. Mine was hanging up after it finished processing (i.e., the Total line). So, I just terminated, then ran git gc, then ran git push and it worked fine.Dialectic
My saviour ! Thanks everyone and thanks @mat !Electrokinetic
git gc made it, just pushed after that and everything went fineFragonard
Nice! This fixed it for me when the only working solution in the past was changing the postBuffer. Thanks!Malvern
This worked for me. Finally! Thank you, this was driving me insane; the smallest of commits would cause this hanging problem. I'm skeptical that it will work again when this problem shows up again only because I have tried other things in the past that worked a few times and then stopped solving this problem after some time.Fingering
I ran this after restarting my VSCode and it worked after a short delay.Ceporah
tried all other solutions , changing buffer and all that but nothing was working. my whole code folder was 2MB. suddently I ran git gc and it worked. my code got pushed on remote.Outfit
K
21

It only worked for me in the case when I did git push -u origin main, when I just simply used git push for bit bucket, it did not push through.

Krever answered 24/6, 2014 at 6:27 Comment(3)
using git push -f origin main would print like these fatal: the remote end hung up unexpectedly Everything up-to-dateSupraliminal
This is so true for bitbucket repo.Shrive
Wow. I did not expect this to work. I'm pushing to Google Cloud Source Repos.Encapsulate
A
14

It can be (as the accepted answer suggests) just a moment to wait, but in the majority of cases it is linked to permissions on the remote. While mostly a non-issue on public git services such as GitHub, Gitlab or Bitbucket, self-hosted remotes might have a special user, or a group for access.

And on new bare repositories it doesn't suffice to change the folder, but instead needs to be recursive because of .git-Folder inside.

Alidis answered 21/3, 2018 at 16:4 Comment(2)
Yep, this was totally the issue on our local group-shared git repo. Weird that git didn't give any errors or warnings.Spectral
... did this a thousand times before ... still needed to read your answer to double check the perms INSIDE the dir, thanks!Estimation
W
14

Adding another local commit and retrying push worked for me.

Winny answered 6/3, 2020 at 17:25 Comment(3)
Changing the postBuffer didn't get me across the line, but this did. Can't say I understand the underlying problem at all, but thankyou!Lampert
This worked for me! Thank youCarmancarmarthen
This worked once or twice for me, but seemed to be more luck than actually somehow solving the problem.Percheron
B
10

For me it worked when I switched to bash instead of zsh terminal.

Barrows answered 23/6, 2022 at 14:46 Comment(4)
There should not be any difference. Your zsh install is probably misconfigured, or you have a misbehaving plugin.Syncytium
Same for me, change to bash terminal fixed itProcter
Same for me. What might be the issue?Inclined
Same, how should I troubleshoot this?Incogitable
T
8

After waiting for two plus hours my git push was still stuck. So, I had to reset back before the commit where I had accidentally uploaded a 3.1mb photo (that I am guessing was the culprit for the freeze).

I found a much more amicable solution that @aroth shared above git config --global http.postBuffer 157286400 was the answer.

I just opened a new iTerm window ran the above command and then ran git push while the terminal in VSCode was still hung up. Then I ctrl c closed the terminal session in VSCode and I was back in business.

Thank you @aroth!

Tko answered 30/12, 2021 at 13:31 Comment(1)
worked like a dream for me!Expound
H
4

Use this command:

git remote add origin <url>
git push -f origin main
Huba answered 25/4, 2020 at 7:25 Comment(0)
H
4

I've had the same issue with pushing commit to GitHub. In my case, the issue was in a branch. I've tried to push the local branch with a relatively large commit without having a remote branch git push --set-upstream origin <your branch name>. I've managed to fix this issue by creating a branch on GitHub and then pushing the commit.

Halt answered 15/12, 2022 at 11:41 Comment(0)
C
3

This problem is solved for me after I use brew install git.

I use macOS 13.0 with M1 chip. It is my new laptop that I only used it for a few days and mainly with GitHub Desktop to work with GitHub. I have the same hanging problem after git push many files via terminal. I tried git gc but it doesn't help me much.

Casteel answered 7/3, 2023 at 15:4 Comment(3)
For the benefit of the novice developers, brew is homebrew which can be installed from hereOneness
Just for the sake of completeness... the solution for me was also to switch from Apple git to official git. The difference is that I use MacPorts, so the solution is sudo port install git. I also had to create a new shell, to pick up the new version.Armbruster
This worked for me on mac m1 pro after trying all other solutions.Recording
E
3

Tuning off the VPN helped me...

Eldrid answered 27/10, 2023 at 20:32 Comment(0)
P
2

Waiting until the upload finished doesn't work for me. I pushed not very big file, but waited long enough, still hanged.

What helped for me is updating from msysgit 1.9.5 to git-for-windows 2.6.2.

Pinkham answered 5/11, 2015 at 10:45 Comment(0)
H
2

Permissions can also be cause of this in the case of a bare repo on a remote machine.

Homozygote answered 24/8, 2018 at 15:10 Comment(0)
D
2

The previous answers did not work for me:

  • increase the buffer, e.g.: git config --global http.postBuffer 157286400
  • clean: git gc

What worked for me

I solved it by pushing every single commit of a Pull Request, instead the whole one.

tl;dr:

git push remote commit:branch

details:

  • show the commits, e.g. git log
  • use one commit hash, e.g. 894cf22
  • push commit, e.g. git push origin 894cf22:dev/task_feature1
  • repeat

further details:

Deathly answered 8/6, 2023 at 21:23 Comment(0)
K
1

See if you have staged, but not committed changes. (git status)

If so, commit (or unstage) those and then try to push. Worked for me.

Koerlin answered 26/6, 2015 at 17:39 Comment(1)
Yes! This worked for me. In MacOS with zsh. MacOS version 12.5.1, git version 2.32.1Discoloration
Q
1

In my case it was caused by a problem with msysgit 1.9.5. Downgrading to msysgit 1.9.4 solved the problem.

Quaker answered 3/8, 2015 at 11:59 Comment(0)
C
1

Just wanted to add this in case it helps anyone. I had the same problem, and the issue was that the git user didn't have permission to write to the files, only to read from them.

Chuchuah answered 8/8, 2018 at 2:38 Comment(0)
H
1

This issue can be caused by issues with your SSH agent.

I recently ran into this issue because I changed my default shell from zsh to bash. I'd originally set up my ssh keys using zsh, and so they were not available by default to bash, using chsh -s /bin/bash.

To fix, you'll need to add your ssh key(s) to the SSH authentication agent using the same shell script (bash, sh, zsh, etc) you're using to perform your git commands:

eval `ssh-agent`
ssh-add ~/.ssh/some_key_rsa

You'll need to enter the passphrase for the key in order to add it. To store the passphrase to your user keychain so you don't need to enter it every time the key is used, add the key with the -K option to the ssh-add command.

ssh-add -K ~/.ssh/some_key_rsa

Note the uppercase K as using a lowercase is a different command option.

Hills answered 19/11, 2019 at 16:37 Comment(0)
D
1

I ran into this same problem while pushing to GitHub. I found that a subset of the files being pushed wasn't being accepted.

I found this out by breaking my large commit into smaller commits (as described in this SO question: Break a previous commit into multiple commits), and then finding success with most of the smaller pieces.

The problem piece contains image files and I'm still sorting out which particular file (or files) triggers the problem.

Dextroglucose answered 5/12, 2019 at 2:0 Comment(1)
I had this same issue on Azure DevOps. My initial commit wouldn't push, so I broke it up into multiple separate commits and pushed them individually. Annoying, but it worked.Insistence
S
1

I had same issue. It's fixed by running this command.

git config --global sendpack.sideband false
Sanjuana answered 8/8, 2022 at 14:47 Comment(2)
Why? What does the command do?Schoen
It disable git sendpack: git-scm.com/docs/git-send-packSanjuana
T
1

In my case, changing remote url from "https" to "ssh" solved the problem.

Tobitobiah answered 15/5, 2023 at 11:16 Comment(0)
B
1

I hit this exact symptom while pushing a specific branch to an Azure Devops Git repo, and tried most of the advice in the thread with no luck.

I opened an internal azure DevOps support ticket, which was immediately resolved as a problem with the Git client itself, and they suggested running:

git config --global http.version HTTP/1.1

... this immediately unblocked me (current default is now 2.0 I guess) and is worth trying if you hit this symptom.

Blackhead answered 15/8, 2023 at 19:21 Comment(0)
E
1

tl;dr

Creating a new remote repository worked.

Pointless, long story.

The problem has only ever happened when I make edits to a particular 6MB .svg file.

I put Git on verbose mode and pushed and left it for hours and the remote hung up.

I suspect the issue only happens for certain remotes; I'm using Google Cloud Source Repositories.

Update

I can confirm it is caused by Inkspace SVG files. I removed one SVG file from the repo but left another in, assuming the one I took out was corrupt or too large.

I made edits to the small SVG file and then committed and pushed and it hung on push. I closed VS Code, pushed again from the terminal and it worked.

Git + Google Cloud Source Repos + Inkscape SVG files cause these hangs for me.

Encapsulate answered 24/9, 2023 at 18:9 Comment(0)
F
1

I solved it by turning off GlobalProtect

Faint answered 7/11, 2023 at 12:31 Comment(1)
this worked me as wellPentose
E
0

I had the same problem. To solve it easily you need to find the largest file in your folder and upload it with an LFS uploader, another solution is to increase the buffer of your git, or delete it from your folder and upload it manually.

Endotoxin answered 5/4, 2013 at 21:30 Comment(0)
W
0

In my case, the remote had a full disk. Removing some files on the remote promptly fixed the issue.

Weary answered 20/5, 2018 at 11:50 Comment(0)
H
0

Checkout the user rights that git is using!

In my case I tried through ssh and the used system user was unable to write into the git bare repository...

Here is how you can debug your ssh connection

Hedley answered 23/7, 2018 at 15:46 Comment(0)
D
0

The problem is that the upload file is big.

Either you wait it out or go to your project folder and delete all the libraries which you could find in the target folder if using maven. Then do the push and it will happen quickly.

Anyways, the library folders need not be stored in git, it's just a waste of git space unless and until they are not available in the maven repositories and you really need to store them

Diaphone answered 26/10, 2018 at 5:30 Comment(1)
Not help-full to anyone ...Ledge
D
0

I wanted to second @Fabio's comment to the original post - that solved it for me.

I'm running my own ad hoc local git server on Raspberry Pi. I forgot to chown the new bare repo, and pushing the first commit from a remote PC would just hang indefinitely.

This fixed it (running chown as root or with sudo):

cd /srv/git
chown git:git -R <repo_name>.git

Replacing <repo_name> with the name of your repo.

Diapason answered 5/2, 2020 at 7:18 Comment(0)
F
0

I had the same issue and it turns out I had an older version (that i deleted but had the same name) of the repo connected to Heroku. When i disconnected it, it completed the push.

Floorwalker answered 10/4, 2020 at 6:43 Comment(0)
T
0

In my case the Git hosting platform GitHub had issues with their servers so check your provider status too.

Terebinthine answered 17/3, 2022 at 14:50 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Corrode
D
0

For me, I had installed Bitdefender and that was causing the issue. Uninstalled it and it was all fine

Doer answered 12/4, 2022 at 12:19 Comment(0)
M
0

I tried all of the answers proposed above, but none worked for me. For some reason, this only happened when I was trying to push to 'master'. When I created and pushed to the 'main' branch, it worked just fine.

Morey answered 21/7, 2022 at 15:28 Comment(0)
A
0

Updating git on the system should work. I had git installed via brew on OS X. brew upgrade git solved the problem.

Probelm description: git push -u origin main was hanging for me after the git output log 'Total ..., reused ..., pack-reused ...' without giving any informative errors.

Adapa answered 7/5, 2023 at 10:44 Comment(2)
Hasn’t this already been answered?Pledge
I didn't see any update answers. The top voted answers explain that it has to do with pushing large files, which was not the case for me. Also another answer recommended installing git, which also was not the case for me (maybe brew install also updates if the package is already installed, but I'm not sure.)Adapa
K
0

I did a git pull origin dev, then I could push.

Kore answered 31/5, 2023 at 20:12 Comment(1)
Noting here that dev is the branch name (could be main or whatever).Selfsufficient
U
0

There was a gif file in the .github folder and github can not process the uploading of that file. When I remove the gif file everything went well.

Uuge answered 28/6, 2023 at 7:16 Comment(0)
C
0

All I had to do was to wait for about 30 mins for the loading to complete.

Clearcole answered 30/10, 2023 at 22:2 Comment(0)
W
-1

I got this recently when trying to push ~40 files around 2MB in total. git push --verbose revealed no errors, but would just hang after Total <...> was written to the terminal.

I reissued a new PAT via GitHub and the push went through as expected.

Wingback answered 3/11, 2021 at 23:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.