451

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?

KevinG
  • 794
  • 2
  • 16
  • 30
DanielLC
  • 4,991
  • 5
  • 15
  • 16
  • please show output of `git remote -v` – CharlesB Mar 06 '13 at 06:59
  • 2
    possible duplicate of [Git fails when pushing commit to github](http://stackoverflow.com/questions/2702731/git-fails-when-pushing-commit-to-github) – CharlesB Mar 06 '13 at 07:01
  • 26
    git config http.postBuffer 524288000 # it works for me – Hari Das Oct 25 '14 at 14:37
  • if you get `error: could not lock config file .git/config: No such file or directory` see http://stackoverflow.com/a/32329453/827525 – niksmac Sep 16 '15 at 04:03
  • 3
    I could not get any of the suggested solutions to work. Then I tried GitKraken. It is one of the few Git programs that doesn't use git.exe. GitKraken could do it. After GitKraken had pushed the repository I could switch back to git.exe and sync without any issues. – lars pehrsson Feb 26 '17 at 10:53
  • 1
    it might be due to network issues – AmiNadimi Jun 06 '17 at 07:21
  • @larspehrsson Please add this as an answers. This solved the problem for me using GitKraken instead, apparently the "official" git package is broken on windows. – aggaton Aug 07 '21 at 18:41

45 Answers45

706

The problem is due to git/https buffer settings. In order to solve it (taken from Git fails when pushing commit to github)

git config http.postBuffer 524288000

And run the command again

Community
  • 1
  • 1
Roman M
  • 7,423
  • 2
  • 14
  • 17
  • 8
    I need the buffer to be higher than 500MB - is that possible? It doesn't seem to make a difference if I make the postBuffer number any higher... – jowie Sep 11 '13 at 13:45
  • Thanks for the link - I sorted the issue by splitting the push into smaller chunks. If I have a problem again I know where to look! – jowie Sep 30 '13 at 08:13
  • This solves my issue as well, I'm guessing it's because a couple of my files went over the default allowed maximum transfer size supported by git? – ffledgling Apr 04 '14 at 08:18
  • As I understand it , git commits as a transaction. sum of all your files were bigger then the http post limit – Roman M Apr 04 '14 at 20:24
  • doesn't solve it for me: git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin develop:develop Pushing to git@github.com:foo/baa.git ERROR: Repository not found. fatal: The remote end hung up unexpectedly Completed with errors, see above – SuperUberDuper Jan 21 '15 at 12:11
  • @SuperUberDuper it looks like you have a different issues. Your ERROR is Repository not found – Roman M Jan 21 '15 at 14:48
  • 21
    Would it be a good idea to use this with `--global`? I deal with large repositories regularly. – DaAwesomeP Feb 02 '15 at 20:55
  • I had a similar problem on Windows 7. After hours of googling, comming accross this post and doubling the buffer size, I discovered it was my antivirus software that was causing the issue – user28864 Feb 15 '17 at 23:36
  • This helps in some cases where the remote end hangs up, but I think in those cases you can see that it fails before all of the objects have been transferred. – mc0e Mar 14 '17 at 05:47
  • issue isn't publicly available anymore :( – shivam13juna Feb 14 '19 at 10:53
  • 4
    @shivam13juna nothing is ever deleted from the internet: :) https://web.archive.org/web/20170119225336/http://github.com/gitlabhq/gitlabhq/issues/3099 – Roman M Feb 17 '19 at 09:06
  • 27
    I ran "git config http.postBuffer 524288000", but still issue not resolved, it still saying the same, the remote end hung up unexpectedly – Narendra Feb 25 '20 at 01:38
  • @jowie I have written an [answer](https://stackoverflow.com/a/64565533/) attempting to note why this value can be as high as 2000000000 (2 GB), and what else needs to be done to make it work. – Asclepius Oct 28 '20 at 02:16
116

Cause : The default file post size for Git has been exceeded.

Solution :

Navigate to repo.

Run the following command to increase the buffer to 500MB after navigating to the repository:

git config http.postBuffer 524288000
penduDev
  • 4,623
  • 33
  • 36
Chinu
  • 1,169
  • 1
  • 7
  • 2
  • 48
    You can also use `git config ssh.postBuffer 524288000` if posting over ssh instead of http. – John M May 11 '15 at 21:01
  • 5
    For some cases `git config --global http.postBuffer 100000000` – Job M Nov 11 '19 at 13:23
  • I get 'fatal: not in a git directory' after execution of this command – ka3ak Feb 05 '20 at 13:44
  • 3
    @JohnM This option doesn't seem to exist, it's not documented in the man page or https://git-scm.com/docs/git-config – Nobody Feb 10 '20 at 11:58
  • I have written an [answer](https://stackoverflow.com/a/64565533/) attempting to note why the `http.postBuffer` value can possibly be as high as 2000000000 (2 GB), and what else needs to be done to make the push succeed. – Asclepius Oct 28 '20 at 02:29
112

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
Community
  • 1
  • 1
Vitalliuss
  • 1,506
  • 1
  • 11
  • 10
  • Why can't I just switch from http to https? – DanielLC Mar 07 '13 at 02:58
  • 15
    bash-3.2$ git remote add origin git@github.com:xxx/xx.git fatal: remote origin already exists. WHY ? – almaruf Nov 03 '14 at 10:36
  • 17
    @almaruf it is because the remote `origin` is already there and you are trying to replace it. git doesn't allow that. So you have to first do `git remote rm origin` then try again. It would work – Alfie Apr 25 '15 at 11:28
  • 2
    make sure you initialise the project if it's a new fresh clone with `git init` – Raul Jul 21 '16 at 09:29
  • you can use either the git protocol over ssh (which requires ssh keys) or the https protocol which requires username and password through a personal access token – I prefer the later – Raul Jul 21 '16 at 09:30
  • The good point of SSH comparing HTTPS is that you can use one ssh key for several repositories and git hostings. I use one key for github, bitbucket and gitlab in despite of different usernames for every hosting. It saves a lot of time for fetch & push operations. – Vitalliuss Sep 19 '16 at 15:51
  • Based on reports at https://bitbucket.org/site/master/issues/4123/fatal-the-remote-end-hung-up-unexpectedly this sometimes helps, but it doesn't work consistently. – mc0e Mar 14 '17 at 05:46
  • Cloning with SSH instead of HTTP works for me. **With SSH I also see a performance increase while cloning** – Vishrant Jul 09 '20 at 02:02
  • My repository size is 70G .I'm use ssh already,but still got the same error – linjiejun Sep 21 '20 at 08:39
  • My repository size is 70G .I'm use ssh already,but still got the same error – linjiejun Sep 21 '20 at 08:39
  • 17
    Could someone explain WHY this would be the solution? As a less experienced github user, this question and the one linked in the answer don't appear to have any connection. I'm hesitant to learn how to do this when there is no logical explanation of why switching to SSH would solve the problem of "remote end hung up unexpectedly" – canderson156 Oct 15 '20 at 13:44
  • caused this issue please help git@github.com: Permission denied (publickey) – Muhammad Tarique Feb 22 '21 at 02:11
  • In my case, this didn't solve the problem, however, it did bring the underlying error to the surface: `remote: fatal: pack exceeds maximum allowed size (2.00 GiB)`. For some reason, using HTTPS didn't provide that error message during the push and instead would only show `fatal: the remote end hung up unexpectedly`. – dev8675309 Mar 03 '22 at 15:23
52

You might get an error like this

error: could not lock config file .git/config: No such file or directory

that is because you don't have a local .git/config file You can get it working by this command:

git config --global http.postBuffer 524288000
nik7
  • 803
  • 3
  • 9
  • 18
niksmac
  • 2,559
  • 3
  • 29
  • 47
36

Other solutions didn't work in my case, doing a garbage collection fixed it for me:

git gc --aggressive

You can try with just git gc first.

nik7
  • 803
  • 3
  • 9
  • 18
Shameen
  • 2,135
  • 1
  • 13
  • 19
  • 36
    This fixed my problem, but it also squashed the detached HEAD changes into a state where merging them became obnoxious (everything was converted to an ADD). I wish I had researched this one more before running it. – MatrixManAtYrService Jul 01 '16 at 03:40
  • This fixed my problem. My problem was (using ssh): $ git push | Enumerating objects: 886, done. | Counting objects: 100% (850/850), done. | Connection to bitbucket.org closed by remote host. | fatal: the remote end hung up unexpectedly | Compressing objects: 100% (831/831), done. | fatal: the remote end hung up unexpectedly – manuelpgs Sep 09 '20 at 02:58
  • Git will exec gc command automaticly before exec push command – linjiejun Sep 21 '20 at 08:45
  • @linjiejun in my case, I could not push until I pulled first, and the pull is where I was getting the error "fatal: Out of memory, malloc failed..." – brethvoice Jul 13 '21 at 15:36
34

Culprit (in my case):
A high-latency network.

This is not an answer per se but more of an observation that may help others. I found that this error pops up occasionally on high-latency networks (I have to use a Satellite dish for internet access for example). The speed of the network is fine, but the latency can be high. Note: The problem only exists in certain scenarios, but I have not determined what the pattern is.

Temporary mitigation:
I switched networks—I moved to a slower, but lower latency cell network (my phone used as a hotspot)—and the problem disappeared. Note that I can only do this itermittently because my cell connectivity is also intermittent. Plus the bandwidth usage adds costs. I'm also lucky that I have this option available to me. Not everyone does.

I'm sure there is some configuration setting somewhere that makes git—or ssh or curl or whatever times out first—more tolerant of such networks, but I don't know what it is.

A plea to developers:
These kinds of issues are a constant problem for rural populations. Please think of us when you design your systems, tools, and applications. Thank you.

t0dd
  • 351
  • 3
  • 2
  • 1
    Thank you! for the solution and plea. – Tom Aug 19 '21 at 12:33
  • ssh itself has some tuning options (keepalives etc) but the main tuning options are generally kernel-level and need to be set on both sides (e.g., over on GitHub as well). Kind of a problem. Something I'd like to see for cases like yours is an aggregator (LAGG interface style) that can use both the satellite and the cell phone networks. This is unfortunately far from trivial. – torek Nov 18 '21 at 07:12
22

Contrary to one of the other answers - I had the problem on push using ssh - I switched to https and it was fixed.

git remote remove origin
git remote add origin https://github.com/user/repo
git push --set-upstream origin master
MikeB
  • 888
  • 8
  • 22
15

If using GitHub, in the repo's directory, run this command to set http.postBuffer to what appears to be its maximum allowable value for GitHub:

git config http.postBuffer 2147483648

If cloning a repo instead using git clone, it can be cloned with the same option:

git clone -c http.postBuffer=2147483648 git@github.com:myuser/myrepo.git /path/to/myrepo

In both cases, the number above is equivalent to 2 GiB. It is however possible that you will need up to this amount of free memory to be able to use this value.

Ensure that each push to GitHub has commits that don't add more than this size of changes. In fact I would keep the commit push size under 1.8 GiB to be safe. This can require dividing a large commit into smaller commits and pushes.

Why this value?

This specific value is used because at least as of the year 2018, this value was documented (archive link) as the push size limit of GitHub:

we don’t allow pushes over 2GB

Why not set lower?

Some prior answers say to set it to 524288000 (500 MiB), but this number seems arbitrary and without merit. Any lower value should work as long as your push size is not larger than the set value.

Why not set higher?

If instead you set the value to higher than 2 GiB, and if your attempted push size is also higher, you can expect the documented error with GitHub:

remote: fatal: pack exceeds maximum allowed size

Asclepius
  • 49,954
  • 14
  • 144
  • 128
10

Based on the protocol you are using to push to your repo

HTTP

git config --global http.postBuffer 157286400

References:

SSH

Add the following in ~/.ssh/config file in your linux machine

Host your-gitlab-server.com
  ServerAliveInterval 60
  ServerAliveCountMax 5
  IPQoS throughput

References:

Asclepius
  • 49,954
  • 14
  • 144
  • 128
HimalayanCoder
  • 9,123
  • 6
  • 53
  • 59
  • In this answer, `http.postBuffer` is effectively set to 150 MiB. If necessary, one can go higher up to 2 GB as I try to explain in my [answer](https://stackoverflow.com/a/64565533/). – Asclepius Oct 28 '20 at 02:22
  • SSH config just fixed my problem with gitlab.com. Thank you a lot. – Alberto Jan 23 '21 at 20:49
  • How do I do this for GitHub? Is my host github.com? – Giovanni May 09 '21 at 08:41
9

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.
Loilo
  • 11,908
  • 7
  • 34
  • 46
8

This article have very good explanation and it solved my problem.

git config --global http.postBuffer 157286400

https://confluence.atlassian.com/stashkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-282988530.html

Awais Jameel
  • 1,384
  • 13
  • 10
7

The following commands might help you...

git config --global http.postBuffer 1048576000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
5

In our case, the problem was a clone that wrote a .git/config file which contained a url entry that was a read only access method. Changing the url from the :// method to the @ method fixed the problem.

Running git remote -v illuminated the issue some.

rayryeng
  • 100,316
  • 21
  • 181
  • 185
Frank P
  • 59
  • 1
  • 1
5

Even after configuring post buffer the issue was not resolved.

My problem was solved when I changed my wifi network from broadband to my mobile hotspot. This might not be the logically correct answer but it solved the issue.

Make sure you have good internet speed.

Devanshi Modha
  • 355
  • 5
  • 8
  • 1
    Thanks for the note. I'm facing the same issue. It seems that something (firewall?) on the local (wifi) network might somehow break the connection to git servers. The connection is otherwise really good here, so I suspect it might be configuration issue on the (MikroTik) router. – kub1x Apr 09 '21 at 12:55
5

None of the above solutions worked for me, however the commit I was pushing was very large.

Very simply, I split it into two commits and pushed each one separately and it went through instantly.

user11809641
  • 735
  • 1
  • 8
  • 20
  • can you explain how to split the commit? – arilwan Feb 22 '22 at 19:07
  • 1
    @arilwan In my case, there were 5 or 10 files, if I recall correctly, so I committed the first half and pushed it, then committed the second half and pushed that. It went through instantly both times. – user11809641 Feb 23 '22 at 02:40
3

If you are using git for windows (and you likely are, if you are doing this on a windows machine), and none of the other fixes here worked for you, try going to https://github.com/git-for-windows/git/releases, and getting a version on or after version 2.4.5. Fixed it right up for me.

rrreee
  • 692
  • 1
  • 5
  • 19
3

You probably did clone the repository within an existing one, to solve the problem can simply clone of the repository in another directory and replicate the changes to this new directory and then run the push.

  • we have a beta ansible workflow and rebuilding the site caused exactly this, cloning the repo on top of the other one. Ansible thing to fix but casing a git problem. Thanks :-) – Alejandro Moreno Mar 24 '16 at 10:33
3

Another addition, since I encountered this error a different way and Google took me here.

My problem was a mismatch of case; one camelCase and one not. Apparently, GIT stops you doing this without telling you why. So if your branches are different from the remote only in the capitalization, try changing them to be identical.

See: Git: 'Master cannot be resolved to branch' after merge

Community
  • 1
  • 1
Thomas
  • 345
  • 2
  • 8
  • I thought I included all relevant info - it's caused by a case mismatch. I've added a sentence to be more explicit, but this isn't really about the link. Sorry if that wasn't clear. – Thomas Dec 03 '15 at 11:08
3

This may occur after updating your OSX platform.

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

cptstarling
  • 761
  • 6
  • 10
3

None of the above answers worked for me, but here's what did.

  1. delete .git/ from your project
  2. clone the remote repo to some new location like your desktop:
    git clone https://github.com/foo/bar.git
    
  3. move .git/ from the new location into the old location
  4. re-commit and push your changes
nik7
  • 803
  • 3
  • 9
  • 18
Ben
  • 17,762
  • 27
  • 102
  • 166
3

In my case I got this error, when pushing with Intellij Idea.

Here is how I traced down my error and fixed it.

  • enable debug logging within the terminal, which is never a bad idea :)
set GIT_CURL_VERBOSE=1 set GIT_TRACE=1 
  • push via the terminal, not via intellij
git push 
-> fatal: The current branch feature/my-new-feature has no upstream branch.
To push the current branch and set the remote as upstream

Solution was to set the upstream, which must have been gone wrong before:

git push --set-upstream origin feature/my-new-feature
Lama
  • 2,716
  • 5
  • 41
  • 57
3

Recently I faced the same problem. When cloning a remote repository I got the error as follows:

fatal: the remote end hung up unexpectedly MiB | 7.00 KiB/s
fatal: early EOF
index-pack failed

When I googled the error I was redirected here. And I followed most of the answers but not solved my problem.

The only solution was to re-install my 'Network adapter (WiFi) driver software'. So, what I want to emphasize is the above error can result from the issues in your PC's WiFi driver software, too. If non of the mentioned answers are not working then you can try reinstalling the WiFi driver. It will solve the issue.

You can easily reinstall the WiFi driver as follows:

  1. Open network and internet settings
    Network and internet settings

  2. Select 'Network reset'
    reset network settings

  3. Then select 'Reset now'
    reset network

After rebooting your pc, try git operations successfully (pushing/pulling/cloning).

Pawara Siriwardhane
  • 1,394
  • 8
  • 21
  • 31
2

PLESK Nginx and GIT I was getting this error on plesk git and while pushing a large repo with (who knows what) it gave me this error with HTTP code 413 and i looked into following Server was Plesk and it had nginx running as well as apache2 so i looked into logs and found the error in nginx logs

Followed this link to allow plesk to rebuild configuration with larger file upload.

I skipped the php part for git

After that git push worked without any errors.

Farrukh Subhani
  • 1,958
  • 1
  • 15
  • 23
2

I solved this issue by repacking:

git repack --max-pack-size=100M -a -d

Go to Repository > Open in command prompt in GitHub Desktop Run the following commands:

set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
git push origin <branch>
Abubakr Elghazawy
  • 851
  • 13
  • 18
2

I got this error too. A second git push did the trick

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 02 '21 at 17:19
1

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)

nopara73
  • 437
  • 5
  • 22
1

I have the same problem. I noticed from the git web page that the SSH clone URL have the next structure:

git@github.com:user/project.git

I could resolve my problem just changing the ":" by "/", as follows:

git@github.com/user/project.git

may be this can be helpful.

Jai Kumar Rajput
  • 3,555
  • 2
  • 34
  • 52
1

Seems almost pointless to add an answer, but I was fighting this for ages when I finally discovered it was Visual Studio Online that was suffering a sporadic outage. That became apparent when VS kept prompting for creds and the VSO website sometimes gave a 500.

Counting objects: 138816, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (38049/38049), done.
error: unable to rewind rpc post data - try increasing http.postBuffer
error: RPC failed; curl 56 SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
The remote end hung up unexpectedly/138816), 33.30 MiB | 3.00 KiB/s
Writing objects: 100% (138816/138816), 50.21 MiB | 3.00 KiB/s, done.
Total 138816 (delta 100197), reused 134574 (delta 96515)
fatal: The remote end hung up unexpectedly
Everything up-to-date

I set my HTTP post buffer back to 2 MB afterwards, since I actually think it works better with many smaller posts.

Asclepius
  • 49,954
  • 14
  • 144
  • 128
Luke Puplett
  • 39,230
  • 39
  • 170
  • 249
1

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.

Jake Lee
  • 6,487
  • 8
  • 43
  • 76
1

I was facing a similar error uploading a large repo, "fatal: The remote end hung up unexpectedly" without any further details.

After a lot of research, here's what I did:

  • Using SSH instead of HTTPS, didn't solve the problem.
  • Increasing http.postBuffer incrementally up to a very large value, still no luck.
  • I figured out that it might be because of large files in the repo (as this is a newly migrated repo from perforce), so I recreated the repo using LFS, setting largeFileThreshold to 40m, which greatly reduced the repo size (from 3.5G to 500M). I thought this will solve the problem, but to my surprise I still faced the same error.

Finally, it occurred to me that may be I'm using an older git client, as I didn't see additional error messages. I upgraded git client to latest (2.20.1), and voila, the error is gone!

Mahmoud Hanafy
  • 943
  • 10
  • 11
  • I also had this exact issue (migrating from TFS though). I upgraded from 2.19 to 2.20 and it was fixed, a cursory look through release notes didn't reveal what the issue might have been though. – George Richardson Jan 18 '19 at 09:04
  • I have just upgraded to 2.20.1.windows.1 and it still won't let me push to the remote repository – Vidar Feb 06 '19 at 17:43
  • @Vidar May be check for large files, GitHub has a strict limit of 100MB https://help.github.com/articles/what-is-my-disk-quota/; Have a look at "Manually reviewing large files in your repository" section in https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html; the page itself is a good read. – Mahmoud Hanafy Feb 12 '19 at 22:21
  • @MahmoudHanafy - thanks - it was a parameter in the web.config about max file size - increase that and git behaves and everyone is happy! It's not GitHub for me but our own private on site Bonobo.Git.Server. – Vidar Feb 13 '19 at 18:04
1

For us the problem was that we had a ton of files that should have instead been managed by git lfs.

We did the following to resolve the problem:

# Soft reset so you can author a new commit
git reset --soft HEAD~1

# Install git lfs
git lfs install

# Track large files of a specified file type YMMV
git lfs track "*.uasset" "*.umap"

# Re-add everything
git add .

# Author a new commit
git commit -m "git lfs ftw"

# Push
git push
bobbyg603
  • 3,248
  • 2
  • 17
  • 28
0

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

Michel Samia
  • 3,973
  • 2
  • 22
  • 23
0

Do this to see the key you're using:

ssh -vT git@github.digitalglobe.com

Then make sure in your build you have this run at the start:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
nik7
  • 803
  • 3
  • 9
  • 18
ddtraveller
  • 919
  • 9
  • 18
0

1) cd to the project dir

2) git status

3) git checkout -f HEAD

4) confirm success by pulling down master again to make sure you're up to date if your repo looked incomplete

This works if you get the error in question from Visual Studio's Git when cloning a repo from Bitbucket

whyoz
  • 5,008
  • 44
  • 52
0

This can also happen if any of the commits you're pushing are malformed.

I (unknowingly) had a commit with a malformed Author Email field, but all I was getting was this vague remote end hung up error message. I was able to push other branches just not this one branch, so I started pushing commits from the "bad" branch one at a time until I finally landed at:

Pushing to git@github.com:directangular/unicorn.git
Counting objects: 100% (9/9), done.
Delta compression using up to 20 threads
Writing objects: 100% (5/5), 549 bytes | 549.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: error: object 74c7584ff0b93591c19d3a3c19695889dd2274d2: badEmail: invalid author/committer line - bad email        
remote: fatal: fsck error in packed object        
error: remote unpack failed: index-pack abnormal exit
To github.com:directangular/unicorn.git
 ! [remote rejected]       pizzafeast -> pizzafeast (failed)
error: failed to push some refs to 'git@github.com:directangular/unicorn.git'

So it looks like the remote end hung up unexpectedly error is sort of "swallowing" the actual error message, which is probably some kind of malformed commit as I have here.

After fixing the malformed email I was able to push just fine.

mgalgs
  • 14,391
  • 9
  • 59
  • 63
0

I dont think its a good idea to do that but if you have backup in ur machine.. push one more time and then try cloning repo and then remove .git from old dir and move .git from new cloned folder .. git is resolved but because of the issue some files may not upload at git. Push again all from ur back up and then pull it to ur server or the other machine where it get currupted. Right now i just did thid ... Works for me .. and take a backup of your dir before doing this.

And plz correct me if i am wrong. I also dont know what can go wrong after doing this? But this time it really works.

Kouki
  • 37
  • 7
0

my issue (fatal: The remote end hung up unexpectedly) has been resolved by checking repository permission and owner.

git repository files owner must be that user you want push/pull/clone with it.

Samir Sayyad
  • 91
  • 1
  • 6
0

The issue cause for me was network settings : I have a "Killer" wifi card which apparently does muck with network packets in a way that SSH and SSL do not like.

To fix the problem, I had to go into "Killer Control Center", "Parameters", and disable "Advanced Stream Detect" - git commands started working again instantly.

Jean-Michaël Celerier
  • 6,602
  • 3
  • 49
  • 69
0

had same problem and try all answer not work, just try another account and that work for me .

Nozar Safari
  • 505
  • 3
  • 16
0

For me,I got the same error when I tried to pull from a branch which is not even existing.

So kindly check the branch name when you pull.

adi
  • 828
  • 14
  • 29
0

switching from bash shell on vscode to zsh fixed it for me.

Alireza tk
  • 427
  • 5
  • 22
0

In my case this error was because of the broken VPN connection. Simply turning off and turning on the VPN fixed the error.

takasoft
  • 1,160
  • 14
  • 15
0

for me, I was using git submodules, solved by:

git fetch 

create any commit on the same branch was develop, then.

git push origin develop
git pull origin develop 
Muhammed Moussa
  • 3,365
  • 28
  • 19
-1

I was able to get around this issue using Git Shell.

Each repository within github.com gives you HTTPS/SSH/Subversion URL's that you can use to download using Shell, see here: http://prntscr.com/8ydguv.
Based on GitHub's recent changes, SSH seems to be the best method.

Command to use in Shell:

git clone "URL of repo goes here w/ no quotes"
S.L. Barth
  • 8,058
  • 71
  • 49
  • 63
David
  • 7
  • 1
-1

I got this error when I had misspelt my remote branch name

javaProgrammer
  • 1,149
  • 1
  • 10
  • 11