Heroku push gives unable to read error message - heroku

I have some issues with pushing to Heroku. When ever I try to push my application I get the error fatal: unable to read {sha1 value}.
The stacktrace is as following:
git push heroku master
Counting objects: 2066, done.
error: unable to find {sha1 value}
Delta compression using up to 4 threads.
Compressing objects: 100% (1954/1954), done.
fatal: unable to read {sha1 value}
I don't have any issues pushing to GitHub, so I don't know if I might have corrupted something in my Heroku application?

Check what git fsck returns, and see if you can copy the missing git object directly in the .git/objects on the heroku server.
That would be similar to the approach taken in "What can I do with Git corruption due to a missing object?".

Related

GitHub Error: RPC failed; curl 92 http/2 stream 0 was not closed cleanly: CANCEL (err 8) | send-pack: unexpected disconnect while reading sideband

I am working on a project with a GitHub repo. I've been able to "add *", "commit" and "push" everything without a problem in the last 3 months. Now I downloaded a dataset containing about 12 GB of data and I have created a new folder for it.
I made some minor changes to the file that was already in the repo (for 3 months) and did "add *", "commit" and "git push".
After counting and compressing the objects, Git Bash throws up this error:
GitHub Error: RPC failed; curl 92 http/2 stream 0 was not closed cleanly: CANCEL (err 8)
send-pack: unexpected disconnect while reading sideband packet
...
fatal: the remote end hung up unexpectedly
Everything up-to-date
This is happening probably while writing the objects.
I have tried the following:
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
git config --global http.postBuffer 100000000
git config --global https.postBuffer 100000000
After the latest attempt with all of the solutions mentioned above, this additional error was thrown after getting to 50% of writing the objects:
remote: fatal: pack exceeds maximum allowed size
A screenshot of the error on Git Bash
So, my question is:
1. Why is this happening?
2. How can I work around/solve this problem and successfully push my current workspace onto GitHub?
I solved this problem by bypassing it with this tutorial:
https://githowto.com/removing_commits_from_a_branch
ATTENTION: Remember to make a copy of your code before proceeding. You can still go back since you aren't deleting commits but it's annoying when you have to follow the tutorial twice.
ALSO: The git hist command is an alias. This is the one I copied:
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
LINK: https://gist.github.com/ecasilla/9669241
1. Why is this happening?
Because you are trying to push a large file. (12 GB dataset)
2. How can I work around/solve this problem and successfully push
my current workspace onto GitHub?
You can use Git Large File Storage that replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com

Git remote push: failed to load advapi32.dll

I am new to Git and Github; and I came across a problem. There is a similiar question here (git bash failed to load advapi32.dll), but they are experiencing a different problem and there are no answers either. I have searched online and was unable to fix this. Here is the issue:
I am using Git Bash to push/pull commits to Github. When I try to push my work, I get this error saying "failed to load advapi32.dll ". I do have this file in my registry. The full Git message is bellow. It is worth noting here, that despite this error, Git is uploading and downloading commits perfectly fine; I just want to fix this problem in case it causes more issues in the future.
$ git push origin master
failed to load advapi32.dll
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 418 bytes | 418.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/khash021/reflections.git
98a7bd9..b982ba4 master -> master
Thanks,
Khash
This problem occurs because the credential halper has been set to wincred and you do not have wincred installed. To verify this, run the command
git config --global credential.helper
if the result says "wincred", this is your problem. To unset the credential helper, run the command:
git config --global --unset credential.helper
That should solve the problem.
First, check your Git version: if it was v2.16.1.windows.2, from 4 days ago, it was quite buggy.
Try with the one released today: v2.16.1.windows.3: uncompress PortableGit-2.16.1.3-64-bit.7z.exe anywhere you want, and define a simplified PATH for testing.
well you could adding the flag:
$ git push origin master --all
Also, given that the .dll file is a system file, check that git has the permission to access it.

Using a network drive as git repository

So, I've created a git repository on the networked drive:
git init --bare --shared
and that works fine. Then, I clone it to a local drive with
git clone z:/testgit
and that also works fine. Then I add a file, stage, and commit
git stage *
git commit -m "test commit"
and that ALSO works fine. BUT! When I try to push to the origin, I get this error.
git push origin
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: unable to write sha1 filename ./objects/f3/e6e90a7465421306fae05c18153260973542e3: Permission denied
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To z:/testgit14
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'z:/testgit'
When attempting to use git stage * directly on the server (on a non --bare git project) I get similar errors.
I have full access to the drive in file explorer, and even able to initialize the repository with git. SSH shouldn't even apply here since it's not a server, it's a networked drive. Everything I've read about git says that this should work. I've read dozens of "how to's" that all say these exact steps, but no one complaining about permission denied, UNLESS they're talking about SSH public keys missing on servers (which, as I've said, shouldn't apply).
What permissions am I missing? Where should I look for and set the proper permissions?
What happens when you try to create the file that git is complaining about?
echo test > ./objects/f3/e6e90a7465421306fae05c18153260973542e3
It's possible that git is creating a new folder (f3) and the folder is not getting the correct permissions, either due to ACL inheritance misconfiguration or because the local machine is trying to adjust the permissions on newly created folders and getting it wrong.
If it were Linux, it could be because the network drive was connected with the wrong mount options, or the umask was set incorrectly, but I'm not sure whether those are available to be changed on a Windows machine.

error on git push heroku master

each time I try to do the git push heroku master I seem that everything works, but after a couple of hour it fails.
The error message is:
$ git push heroku master
Counting objects: 599, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (318/318), done.
remote: fatal: early EOF
Writing objects: 100% (599/599), 552.65 MiB | 56.00 KiB/s, done.
Total 599 (delta 170), reused 585 (delta 163)
error: unpack failed: index-pack abnormal exit
To https://git.heroku.com/foo.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'https://git.heroku.com/foo.git'
Can't solve the error, and it takes a long time before it fails each time I try.
Is the first time I'm going to deploy a project, I would also apreciate some advise if there is something better (and/or cheaper) than heroku for uploading a rails project. And a good tutorial to follow, because I need to use a custom domain (.com) and everything, and at this point I'm not sure what I have to do.
I followed this tutorial for heroku:
https://devcenter.heroku.com/articles/getting-started-with-rails5
Edit: I checked since the first time I tried to upload to heroku, and now I see that the first time the error was different, and since then always the same error I commented before. This is the first error:
git push heroku master
Counting objects: 580, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (462/462), done.
error: unable to rewind rpc post data - try increasing http.postBuffer
error: RPC failed; result=56, HTTP code = 0
fatal: The remote end hung up unexpectedly | 0 bytes/s
Writing objects: 100% (580/580), 552.65 MiB | 240.00 KiB/s, done.
Total 580 (delta 155), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date
It seems a problem with git in your case. You could try to run the git repack command or to clone your repository again, and then deploy to Heroku. If this still fails, perhaps it'd be a good idea to contact their support.
I think that if you are deploying a project for the first time, I think Heroku is the easiest way, but this is my opinion. Adding your custom domain to it is faily easy too, you can check how to do it here.
I contacted the heroku support, and they told me kindly what I was doing something wrong.
It seems that my project folder was 1,2GB, and with the .gitignore it was about 550MB. And in a free account I only can push 500MB maximum.
I looked folder by folder and file by file how many space are they using. And surprisingly it was about 50MB.
The other 500MB to the 550MB were hidden files inside the project which I didn't know anything. Maybe git files, I don't know.
So I copied all the visible files and folders to a new folder, I made a new .gitignore, a new git init, and a new heroku create. Now the main folder was only about 150MB, and when I wanted to push the project to heroku it was only 49MB.
So if you have the same problem I had check the weight of your files, maybe you have big hidden files. And it solved the problem to me.
Adding the following to gitconfig fixed this issue for me:
git config http.postBuffer 524288000
This allows for larger files to be pushed to a given repo. (I think🤓)

"Heroku push rejected, no Cedar-supported app detected" when trying to upload a Sinatra app with an existing git repo

I have an existing git repo for my personal website, which I am porting to Sinatra (mainly for templating, it's a static site). I do NOT want to lose/reset this git repository.
When I try to push to Heroku, I get the error below. I have a config.ru file, a Gemfile, and a Gemfile.lock, along with some other stuff for Sinatra. Running rackup works, running bundle exec rackup works, and I didn't get any warnings from Heroku about missing dependencies.
Am I missing something? I can post the directory structure of my site if it would help (though it's close sourced).
~/Repos/website ➜ gp heroku master
Counting objects: 2836, done.
Compressing objects: 100% (2669/2669), done.
Writing objects: 100% (2836/2836), 3.48 MiB | 252 KiB/s, done.
Total 2836 (delta 481), reused 2117 (delta 155)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:APP_NAME_HERE.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:APP_NAME_HERE.git'
A Cedar app should recognise the config.ru file and create a web process for you, so it's possible that some essential file is not tracked by git. Check that config.ru, Gemfile and Gemfile.lock are all committed (you can use git status, but note that it will not output anything for ignored files so you should also check your .gitignore file).
If all the files are committed, you could also try specifying the command you want the web process to use in a Procfile. See the Heroku docs for more information:
Getting started with Ruby: Declare process types with Procfile
Declaring and Scaling Process Types with Procfile
Problem solved. I was working on a git branch especially for Heroku/Sinatra support, and it turns out I was running git push heroku master, which pushed local master to remote master. The master branch did not have a valid Heroku app. I assumed it would push the current local branch to the remote master branch, which is not the case. git push sinatra:master solved the issue.
For those who find that the accepted answer doesn't solve their problem, this related question may provide the solution: "Heroku push rejected, no Cedar-supported app detected" when trying to upload a Sinatra app with an existing git repo

Resources