Git push takes forever

76,120

Solution 1

Try using the --verbose option to see what actually happens. Even if you did small changes, some internal things might cause git to push a lot more data.

Have a look at git gc. It cleans up your local repository and might speed up things, depending on you issue. Backup strongly advised.

Solution 2

I had the same problem. If you are using Bitbucket.org, I don't know why, but disabling IPV6 connection fixed the problem.

Solution 3

Ensure you're using the right protocol.

Depending on how you have your local configurations set up, you might need to use https to connect. To do so, switch the protocol for the remote repository from the [email protected]:[user]/[repo] protocol to the https://github.com/[user]/[repo].git protocol.

Also, it's worth trying vice versa, if you're unable to use the https protocol. On older configurations, the older git@github user authentication will often allow you to connect as a fallback.

Solution 4

I have faced a similar issue using git bash. Using these commands helped.

git config --global core.preloadindex true  
git config --global core.fscache true 
git config --global gc.auto 256

https://blog.praveen.science/solution-to-git-bash-is-very-slow-in-windows/

Solution 5

Ensure you are authenticated to github: For me, it was my authentication. I was running the command with git bash on windows and for some reason, it didn't prompt me to authenticate. when I ran it with the command prompt, I got this

Select an authentication method for 'https://github.com/':
1. Web browser (default)
2. Personal access token
option (enter for default):

after I successfully authenticated, it worked fine

Share:
76,120
Codeformer
Author by

Codeformer

Programmer Love coding, follow politics & sports Play Badminton and Soccer Believe in the power of technology to bring social reform

Updated on March 30, 2022

Comments

  • Codeformer
    Codeformer about 2 years

    When I am trying to push to my remote git repository, but it is taking forever and nothing happens. I waited for so long, but push is never getting finished. My OS is Ubuntu 12.10. Thank you.

    • phisch
      phisch about 11 years
      Can you browse github manually? are you behind a proxy? What happens when you add --verbose? We need more info to help you
    • Codeformer
      Codeformer about 11 years
      Yes, I am able to do everything else , Pull , fetch , commit locally and browse through github. The only problem is while pushing. It never happens I waited for so long ,so many times. Some times I got No fast-forward error, But then i pulled from repository to resolve it and when I pushed, then it just goes on but never ends.
    • mvp
      mvp about 11 years
      Please provide more info. Are you using ssh or https remote url? How big is your repository? Is it possible that repository is hundreds of megabytes because of some commit you did recently with a huge binary files?
    • Waleed Khan
      Waleed Khan about 11 years
      How long is “forever”?
    • James McLaughlin
      James McLaughlin about 11 years
      @WaleedKhan ∞ seconds. :-)
    • Codeformer
      Codeformer about 11 years
      @mvp Repository is of 200mb, But the recent commits were small. I am using https.
    • Kevin
      Kevin almost 10 years
      It stops at Pushing to [email protected]:appname.git. I am using Ubuntu 14.04.
    • MJ Delos Santos
      MJ Delos Santos about 2 years
      Sometimes I forget that the pop-ups can hide behind the command prompt.
  • Tony Brasunas
    Tony Brasunas almost 10 years
    This worked for me again today. But it was switching to the git@github protocol that worked. For me, it might have to do with some config options on GitExtensions, which is the git client I'm using.
  • Fernando Santiago
    Fernando Santiago almost 4 years
    How did you disabled IPV6?
  • Felipe Desiderati
    Felipe Desiderati almost 4 years
    It will depend on the SO which you use. In Ubuntu, using the UI, it would be: Settings > Network > Ipv6 Tab > Disable. But there are other methods.
  • vinitius
    vinitius about 3 years
    Thank you! This is probably related to some router configurations blocking specific ipv6 traffic or even the local internet provider blocking it. If you don't need to use any ipv6 services, disabling it will make it work fine (on Ubuntu, make sure to disable it via /etc/sysctl.conf). If you need ipv6, then force your PC to use bitbucket's ipv4 by adding this to your hosts file: 104.192.143.3 bitbucket.org
  • Ranvir
    Ranvir about 3 years
    I changed my remote to use ssh from https, and this issue started, I went back to https and worked for me now.
  • Admin
    Admin over 2 years
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.