Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git hangs on push

I cannot push to github. I was able to push little changes, but this time, it hangs after it writes this:

git push origin master
Counting objects: 22, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.51 KiB, done.
Total 12 (delta 8), reused 0 (delta 0)

On my Ubuntu Process Manager, I saw that ssh hangs when I try to push something and it is: ssh [email protected] git-receive-pack 'xxx/yyy.git'

When I try to directly run this command on my terminal, now it hangs after it writes this:

0078...7d4 refs/heads/master report-status delete-refs side-band-64k quiet ofs-delta
0000

All the other thins work well, but I can't push. What could be the reason?

Additional information: I re-created the git file and changed the remote to HTTP from SSH. Now I get this error when I try to push:

Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.19 KiB, done.
Total 9 (delta 6), reused 0 (delta 0)
error: RPC failed; result=52, HTTP code = 0
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

Extra information 2: I've been tested it for hours and it looks like my network connection is the problem. I tried to push from another connection, and it worked very well. What could be the reason behind this? The modem's firewall is disabled, by the way.

like image 315
gzg Avatar asked Dec 12 '12 00:12

gzg


People also ask

Why is git push taking so long?

If you are starting a new project from a clone, (from the CLI without a fork) when you push to a blank remote you are pushing the entire history of the project you just cloned. This is going to take some time. If you just need the clone as it stands and you don't want the history, delete the .

Why my git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

How do I force a git push?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>... section above for details. Force an update only if the tip of the remote-tracking ref has been integrated locally.

Can git fetch but not push?

Some common reasons include: - You are not logged in to your account: see File > Options. - You may need to log out and log back in to refresh your token. - You do not have permission to access this repository. - The repository is archived on GitHub.


2 Answers

I've spent the last 5 hours trying to fix a similar problem. First, are you running this over a tunnel or VPN connection?

Turns out that the MTU (Maximum Transmission Unit) of a tunnel can be misconfigured in that some router in the middle of the network path can only support a lower MTU but this isn't known to the VPN/tunnel software, resulting in dropped packets.

So the quick answer is to try to lower the MTU of your connection:

sudo ifconfig eth0 mtu 1300

Here I'm setting the MTU for the eth0 interface, replace with the interface you're actually using to access the git server. The default MTU is usually 1500.

For OpenVPN I had to update the tun0 interface. There is a better/more robust way to do this in the OpenVPN configuration: use the link-mtu <n> and mssfix options.

like image 172
Ezequiel Muns Avatar answered Oct 22 '22 04:10

Ezequiel Muns


In my case issue was related with access rights to repository. I had read only access, after adding rights to write, issue was solved.

like image 40
user2399170 Avatar answered Oct 22 '22 04:10

user2399170