Git, fatal: The remote end hung up unexpectedly

2019-01-03 00:42发布

When I tried to run

git push origin master --force

I just got

Counting objects: 2649, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1280/1280), done.
error: RPC failed; result=22, HTTP code = 413 | 116 KiB/s   
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2504/2504), 449.61 MiB | 4.19 MiB/s, done.
Total 2504 (delta 1309), reused 2242 (delta 1216)
fatal: The remote end hung up unexpectedly
Everything up-to-date

Is it something to do with not being secure? I tried creating a public key as in the answer for Fatal: The remote end hung up unexpectedly and running it again, but it still doesn't work. Am I not actually using the key? If so, how do I use it?

21条回答
Viruses.
2楼-- · 2019-01-03 01:10

This error can also be thrown through missing write permissions on the repository.


My concrete case went like this:

  1. I created a repo with the root user of my server (via SSH).
  2. I installed a git service and created a git linux user that should manage all git-related action.
  3. By that time, I had forgotten that the repo was created with the root user in the first place, and the git user simply didn't have the file permissions to write anything into the repository.
查看更多
Anthone
3楼-- · 2019-01-03 01:11

Seems like it can be one of a thousand things.

For me, I was initially pushing master and develop (master had no changes) via SourceTree. Changing this to develop only worked.

查看更多
做自己的国王
4楼-- · 2019-01-03 01:12

This looks similar to How do I get github to default to ssh and not https for new repositories. Probably it's worth trying to switch from http protocol to ssh:

$ git remote add origin git@github.com:username/project.git
查看更多
乱世女痞
5楼-- · 2019-01-03 01:12

I happened to have the same error at pull.
I have done the "http.postBuffer" trick. It solved it, but when I wanted to push, I encountered the error again.

What solved my problem:
1. Cloned it to an other folder with an other virtual machine. (Linux).
2. I've done my changes.
3. Pushed it with the original virtual machine where I initially couldn't push. (Windows)

查看更多
做自己的国王
6楼-- · 2019-01-03 01:13

This may occur after updating your OSX platform.

Open Terminal and navigate to your .ssh-folder, and enter ssh-add -K ~/.ssh/id_rsa

查看更多
闹够了就滚
7楼-- · 2019-01-03 01:13

I got this error when I had incorrect keypair in .ssh. Adding the pubkey to github (in settings) fixed this issue for me.

查看更多
登录 后发表回答