Git Push Hangs

Abdul Jabbar Sep 13, 2022
Git Push Hangs

Sometimes developers go through a situation when they want to push some changes to the repository by using the command git push, and after applying this command, they come to know that their system has started hanging, and they feel clueless about this situation.

This situation occurs when the developers have a personal computer with very old technology, and their memory does not have enough support to manage these actions.

One of the proper and long-term solutions to this problem is to upgrade the personal computer or the system and use the Git commands without any issues.

This tutorial will help us solve the hanging problem when a git push is applied to huge files using the Git command.

Git Push Hangs Solution

Developers usually face these problems due to the colossal size, which requires much time to upload. That’s why the file shouldn’t be added in the push command in the first run.

git config --global http.postBuffer 524288000

The following commands will only apply to ssh.

  1. Here, we have to make a script like ~/

    ssh -vvv "$@"
  2. Then, we have to add permissions through the following command.

    chmod u+x ~/
  3. Then push it to the repo where you were pushing the code.

    GIT_SSH=~/ git push <rest of your command>`

Use Git askpass

We can also solve this hanging issue using the following command line script.

git config --global core.askpass "git-gui--askpass"

The above command is mostly used when the command is not getting the first argument to the node correctly, causing the hanging problem in the git push command in Git.

Restart SSH Agent

If the problem is still not solved, then the final solution to this issue is to restart the SSH agent by using the following command in Git.

killall ssh-agent; eval `ssh-agent`

These SSH keys are mostly saved at the location ~/.ssh/id_rsa and ~/.ssh/ We can also transfer these keys to another location if that issue still occurs in the future.

But the above command will reset your SSH-related issues, and the hanging issue will eventually be solved.

Author: Abdul Jabbar
Abdul Jabbar avatar Abdul Jabbar avatar

Abdul is a software engineer with an architect background and a passion for full-stack web development with eight years of professional experience in analysis, design, development, implementation, performance tuning, and implementation of business applications.


Related Article - Git Push