pushing to heroku git error - ruby-on-rails

I have created a brand new heroku app, beforehand i deleted the old .git file from my app's directory and created a new one with the usual steps:
git init, git add ., git commit -m "new git"
all of which worked fine. I then created a new app like so and got the following error:
$ heroku create
Creating glowing-summer-56.... done
Created http://glowing-summer-56.heroku.com/ | git#heroku.com:glowing-summer-56.
git
Git remote heroku added
$ git push heroku master
Counting objects: 1553, done.
Delta compression using up to 4 threads.
fatal: object 91f5d3ee9e2edcd42e961ed2eb254d5181cbc734 inconsistent object lengt
h (387 vs 8985)
error: pack-objects died with strange error
error: failed to push some refs to 'git#heroku.com:glowing-summer-56.git'
This is strange to me, as it is a brand new .git file. How can I get rid of this without cleaning up each damaged object? Is there a way to just delete the git file and start anew? I'm not using this git file for anything other than pushing to heroku.
Also I should note that I am using Cygwin on windows and my git version is 1.6.6.1
I've come across this error before and fixed it, I just honestly can't remember how.
Finally, using git fsck --full yields nothing :(
Thanks,

i seemingly fixed this with: git reset

Related

git push heroku master error: Could not read

I tried looking through some git push heroku master errors on this website, but I couldn't find one with my specific problem. Hopefully you guys can help me.
When I run git push heroku master
error: Could not read 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: bad tree object 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'https://git.heroku.com/still-harbor-74893.git'
fatal: write error: Bad file descriptor`
I've read that Heroku sets a hard limit on file sizes, is that the problem?
Check whether your github file is corrupted or not. Or maybe one of the file is corrupted. I can't think of anything else that might be the problem here.
I'm guessing that your repository/current directory is broken. If you think that your current working directory contains uncorrupted files, then you can always re-initialize Git in your working directory. For example:
rm -rf .git
git init
git add .
git commit -m 'Re-initialize repo.'
And then try to push to heroku.

Git push origin master fatal error: Permission to railstutorial/first_app.git denied

I'm trying to git push origin master using Michael Hartl's rails tutorials (first_app), but i'm getting this problem:
[first_app]$git push origin master
ERROR: Permission to railstutorial/first_app.git denied to tomkim
fatal: The remote end hung up unexpectedly
I've re-entered an SSH key, but that's not it. I've never had this problem before, but now I am.
Help's greatly appreciated.
You need to add your own repo as the remote (of course you need to create a first_app repo on Github first):
$ git remote rm origin
$ git remote add origin git#github.com:tomkim/first_app.git
$ git push -u origin master
And tomkim is your github account name, right? If not, change it to yours.
I was able to figure this out. I noticed that the origin was showing "railstutorial/first_app.git", when that it should've been tomkim310/first_app.git. The problem to begin with was follow Hartl's tutorial, I was just typing as he was going. Simply doing a new "git remote add origin git#github.com:tomkim310/first_app.git" does not do the trick.
I verified this by typing in: git remote -v which gave origin git#github.com:railstutorial/first_app.git. To change it, i typed: git config remote.origin.url git#github.com:tomkim310/first_app.git.
This then did the trick and git push origin master worked.

Change github repository for Rails

How do you change the git repository a rail app is pushed to? I know that this is possible because I did it a few weeks back.
Basically I have two very different versions of a app on my local machine. I would like the initial app to still point to the old repository. However, the new version needs to be placed in a completely separate repository.
When I run git init in myapps/old_app/ it puts Reinitialized existing Git repository in /Users/jamespollard/rails/old_repository/.git/
AND
When I run git init in myapps/new_app/ it puts Reinitialized existing Git repository in /Users/jamespollard/rails/new_repository/.git/
However, when I try and git push anything to the repository, it still goes to the old_repository.
Updates
If I enter $ git remote origin set-url git#github.com:mygithub/myapp.git
I get
error: Unknown subcommand: origin
usage: git remote [-v | --verbose]
or: git remote add [-t <branch>] [-m <master>] [-f] [--mirror=<fetch|push>] <name> <url>
or: git remote rename <old> <new>
or: git remote rm <name>
or: git remote set-head <name> (-a | -d | <branch>)
or: git remote [-v | --verbose] show [-n] <name>
or: git remote prune [-n | --dry-run] <name>
or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
or: git remote set-branches <name> [--add] <branch>...
or: git remote set-url <name> <newurl> [<oldurl>]
or: git remote set-url --add <name> <newurl>
or: git remote set-url --delete <name> <url>
-v, --verbose be verbose; must be placed before a subcommand
If I enter $ git remote set-url git#github.com:mygithub/myapp.git I get the same error message as above (minus the origin error). In either case, if I run git push origin master it still pushes to the old repository. I've tried adding the new repository again with the same name, but I get a error (which i would expect) saying that it already exists.
Create a new repository in GitHub for you new app, if you haven't already. Make that new repository as origin to your new repository:
git remote add origin <github_url>
If the remote already exists, you might have to git remote set-url origin <github_url>
Now, push to the repo.
I ran into a pretty similar situation few months ago. On the new version of the app there is a .git folder (which was also copied along with all other files when you copied the app). Heroku needs the information from .git to see if anything has changed. So when it 'reinitialized', heroku thinks its the same app.
So here's what I did that resolved the problem.
Copied the entire app folder.
Changed app name wherever they appear (mostly in config folder, google it for a list)
Chang secret.yml file (get a new key by rake secret) or secret token if older version
of rails.
Most importantly, there should be a .git folder in your app folder (it maybe hidden).
Delete that .git folder (it contains git info of the old app)
Initialize a new git, git init
and then commit and push.
Your new app should be a separate app now.
I think this might work if on heroku, worth a try:
git remote rm heroku
git remote add heroku git#heroku.com:yourappname.git
or you can try this
1). open a terminal
2). Go to your_app_directory/.git/config
3). Once you open the config file then edit as follows:
Change
url = git#heroku.com:old_app_name.git
to
url = git#heroku.com:new_app_name.git
Obviously substituting your apps old name to its new name. Hope it helps
If you take a peek at your .git/config file, you see / check that the url is still pointing to the old remote
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = <old_github_url>
so you wish to keep the old remote. let's call that oldremote.
First thing you can do is the rename the remote with :
git remote rename origin oldremote
Now you can add the new remote with :
git remote add origin <new_github_url>
From now on, pushing normally with just git push will push to the new remote. git push oldremote SHA to push to the old remote
remote reference : http://help.github.com/remotes/

Ruby on rails and Heroku problem

$ git push heroku master
I basically get this error message.
error: src refspec master does not match any.
error: failed to push some refs to 'git#heroku.com:falling-stone-505.git'
I'm very new to computer programming and ruby on rails so an "idiots" guide to solving this would be appreciated.
Thanks in advance.
You haven't committed anything to push yet. Try doing:
$ git add -A
$ git commit
Then try to push to Heroku again.
You might try following along with this tutorial, although I can't vouch for it. Most of the professional endeavors in this space are books.
If you want your commits to be easier to track in the future, after
1.
$ git add -A
2.
instead of
$ git commit
you can use
$ git commit -m "add a message here such as FIRST COMMIT or PROBLEM WITH CONTACTS VIEW ADDRESS VARIABLE TYPO FIXED."
3.
Then you can
$ git push heroku master

what does PATH/TO/MY_APP means?

Here a step of installation in heroku web hosting website:
Track your application with Git
If you’re already using Git with your application, skip to the next step. If you’re not yet using Git to track your application, run this:
$ cd PATH/TO/MY_APP
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "new app"
Created initial commit 5df2d09: new app
44 files changed, 8393 insertions(+), 0 deletions(-)
when I cd to the PATH/TO/MY_APP
there's no such dictionary, So I guess it's a custom path which should add to the user path file manually, Is that right?
It means path to your app, so if your app is in /usr/bin/myapp, than it is "/usr/bin/myapp".

Resources