[Solved] Git push takes forever

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.

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.

Respondent: phisch

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.

Respondent: Felipe Desiderati

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 [email protected] user authentication will often allow you to connect as a fallback.

Respondent: Tony Brasunas

Solution #4:

One possibility might be that you have large binary file(s) commited in the latest commit. git is not good at working with binary file. If commiting binary files was a mistake, you can refer to following answer for getting rid of binary file in commit.

https://stackoverflow.com/a/58987943/8694152

Respondent: MS_

Solution #5:

Every time I reinstall or upgrade Ubuntu (all 3-4 times), I had to go to the DNS settings of my internet connection (both Ethernet and Wifi), remove Automatic and add 8.8.8.8 and 1.1.1.1. After a reset git push and all other git-origin-accessing commands go down from 1 minute to a few seconds.

Respondent: Bill Kotsias

Solution #6:

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

Respondent: Azeez Lukman

Solution #7:

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/

Respondent: abhinay_cf

Solution #8:

Please check the permission rights on the remote dir. In my case, after setting the correct permissions by chown -R user.group /dir, the commit is correctly finished:

$ git push --verbose
Pushing to ssh://[email protected]:port/dir
[email protected]'s password:
Counting objects: ...
...
Total 123 (delta 21), reused 16 (delta 12)
To ssh://domain.zone:port/dir
 * [new branch]      master -> master
updating local tracking ref 'refs/remotes/origin/master'

Solution #9:

Make sure you have connectivity to the Bitbucket server. In my case it worked after I connected to our company network over VPN.

Respondent: Matt

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.