简体   繁体   中英

git push hangs after Total line

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?

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.

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

它仅在我执行git push -u origin main的情况下对我有用,当我只是简单地将git push用于位桶时,它并没有通过。

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 remote s 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.

添加另一个本地提交并重试推送对我有用。

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 .

在远程机器上的裸仓库的情况下,权限也可能是导致此问题的原因。

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.

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.

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

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.

Use this command:

git remote add origin <url>
git push -f origin main

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.

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.

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

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

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

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.

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.

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.

As noted in other answers, it seems that Git performs network activity during this phase of the push, without showing any kind of progress indicator, which is quite confusing when the operation can be very slow under some circumstances.

This can be confirmed by setting trace environment variables for the git push command. For example, if using a HTTP-based method, setting GIT_CURL_VERBOSE=1 should show you network transfers taking place during this phase, though this won't help much other than confirm the push is not actually hanging!

In terms of actually fixing the problem: I have had this happen to me when pushing to GitHub, even in cases where the branch I'm trying to push only contains a few small file differences compared to the merge base commit that already exists on the remote side.

At first I found this completely baffling, but eventually I realised I was committing on top of a local branch that I'd previously pushed to the remote, created a pull request for, merged, and then deleted the remote branch . In other words, I was pushing on top of a branch that I'd already deleted from the remote.

I'm not sure exactly why, but it appears in such cases that Git can be unable to determine a sensible set of data to push, and tries to push a non-trivial subset of the entire repo (which in my case was large but not ridiculously so, in the tens of megabytes, but this was enough to make the push process unworkably slow).

In such cases, I was able to fix the problem by first fetching the latest updates from the trunk (eg master ), merging them into the branch I'm trying to push, and then retrying the push, so I'm pushing a commit that's a descendant of the latest trunk commit. This seems to enable Git to determine a much more sensible set of data to push, making the push much faster.

The problem feels similar to the one discussed in this answer .

就我而言,Git 托管平台 GitHub 的服务器存在问题,因此请检查您的提供商状态。

对我来说,当我切换到 bash 而不是 zsh 终端时它起作用了。

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.

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.

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

git config --global sendpack.sideband false

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.

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

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

The previous answers did not work for me:

  • increase the buffer, eg: 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, eg git log
  • use one commit hash, eg 894cf22
  • push commit, eg git push origin 894cf22:dev/task_feature1
  • repeat

further details:

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.

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM